New Asynch Google Analytics Ecommerce Tracking

General ShopSite user discussion

New Asynch Google Analytics Ecommerce Tracking

Postby Rgkopchak » Thu Nov 11, 2010 11:08 am

I found a thread here with some good info on adding the Ecommerce tracking code to GA. It was a little old though, and now that google is using Asynchronous Syntax I wanted to run this by everyone to look at before I go live with it:

Here is the reference page I used from Google: http://code.google.com/apis/analytics/docs/tracking/gaTrackingEcommerce.html

Not sure about ss_associate, since I do not every have that set on my transactions (should I just insert the company name?) Also, where it says "Products", that is what corresponds to Google's "category or variation". Is there a variable that could go there?

Does everything else look right? Thanks in advance for any/all advice.

Code: Select all
<script type="text/javascript">       
   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', '-']);
   _gaq.push(['_trackPageview']);
   
   _gaq.push(['_addTrans',ss_ordernum, ss_associate, ss_ordertotal, ss_taxtotal, ss_shiptotal, ss_city, ss_state, ss_country)]);
   
   for (var p = 0 ; p < number_products ; p++) {
     gaq.push(['_addItem',ss_ordernum, ss_sku[p], ss_name[p], "Products", ss_price[p], ss_quantity[p]]);
   }

   _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

   (function() {
     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   })();
       
</script>
Rgkopchak
 
Posts: 61
Joined: Wed Jul 28, 2010 7:45 am
Location: Missouri

Return to User Forum

Who is online

Users browsing this forum: No registered users and 27 guests

cron