Google Analytics Ecommerce Tracking Script - Ecommerce Forums
Results 1 to 2 of 2

Thread: Google Analytics Ecommerce Tracking Script

  1. #1

    Question Google Analytics Ecommerce Tracking Script

    I recently noticed that we were getting double counts on some conversions in analytics, so I checked the source code on an orderfinished.asp order completed confirmation. I found two sets of ecommerce conversion tracking scripts.

    One matches what is found here:

    http://www.convergent7.com/volusion/...ytics-upgrade/

    The other is below.

    What code is correct?
    Code:
    <!-- BEGIN GOOGLE ANALYTICS ECOMMERCE TRACKING SCRIPT (INSERT IN ARTICLE 49) -->
    <script type="text/javascript" language="Javascript">
    	try {
    		if( typeof Order != 'undefined' ) {
    
    			_gaq.push(['_addTrans',
    				Order[0],                   // order ID - required
    				'Volusion Shopping Cart',   // affiliation or store name
    				Order[2],                   // total - required
    				Order[4],                   // tax
    				Order[5],                   // shipping
    				Order[6],                   // city
    				Order[7],                   // state or province
    				Order[8]                    // country
    			]);
    		
    			for (var i=0; i < OrderDetails.length; i++){ //for each product
    				_gaq.push(['_addItem',
    					OrderDetails[i][0],          // order ID - required
    					OrderDetails[i][2],          // SKU/code - required
    					OrderDetails[i][3],          // product name
    					OrderDetails[i][4],          // category or variation
    					OrderDetails[i][5],          // unit price - required
    					OrderDetails[i][6]           // quantity - required
    				]);
    			}
    			_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    		}
        }
    	catch(e) {}
    </script>
    <!-- END -->

  2. #2
    Do you have enhanced ecommerce tracking enabled? Because this is the code I use, and it has always worked just great:
    Code:
    <script>
    ga('require', 'ecommerce');
    ga('ecommerce:addTransaction', {
      'id': Order[0], // Transaction ID. Required.
      'revenue': Order[2], // Grand Total.
      'shipping': Order[5], // Shipping.
      'tax': Order[4] // Tax.
      });
    for (var i=0; i < OrderDetails.length; i++) {
      ga('ecommerce:addItem', {
      'id': OrderDetails[i][0], // Transaction ID. Required.
      'name': OrderDetails[i][3], // Product name. Required.
      'sku': OrderDetails[i][2], // SKU/code.
      'price': OrderDetails[i][5], // Unit price.
      'quantity': OrderDetails[i][6] // Quantity.
      });
      }
    ga('ecommerce:send');
    </script>
    It's not fresh, but it's fruit.

Similar Threads

  1. Replies: 10
    Last Post: 11-09-2014, 11:11 AM
  2. Replies: 13
    Last Post: 12-03-2013, 10:41 AM
  3. Google Analytics Not Tracking All Sales
    By reigny in forum Analytics
    Replies: 11
    Last Post: 11-07-2013, 04:24 PM
  4. Replies: 0
    Last Post: 02-13-2013, 10:08 AM
  5. Google Analytics Event Tracking on Volusion
    By waughkev in forum Search Engine Optimization
    Replies: 0
    Last Post: 09-13-2012, 10:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •