Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google Analytics Asynchronous Tracking Not Recording Ecommerce Transactions.


Trentide

Recommended Posts

Thanks for looking at my post. I've installed GA and it works great! Unfortunately, the ecommerce transactions are not being recorded. Apparently, I need to install additional code to the GA code already installed on my site. Does anyone know how to do this? Also, I'm not even sure how to configure this code. Thanks for any and all info.

 

First, here's my GA code as it appears on my site:

 

 

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">

</script>

<script type="text/javascript">

 

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'CORRECT ACCOUNT']);

_gaq.push(['_trackPageview']);

 

(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>

 

 

Next, is the code I need installing and configuring...

 

<html>

<head>

<title>Receipt for your clothing purchase from Acme Clothing</title>

<script type="text/javascript">

 

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXX-X']);

_gaq.push(['_trackPageview']);

_gaq.push(['_addTrans',

'1234', // order ID - required

'Acme Clothing', // affiliation or store name

'11.99', // total - required

'1.29', // tax

'5', // shipping

'San Jose', // city

'California', // state or province

'USA' // country

]);

 

// add item might be called for every item in the shopping cart

// where your ecommerce engine loops through each item in the cart and

// prints out _addItem for each

_gaq.push(['_addItem',

'1234', // order ID - required

'DD44', // SKU/code - required

'T-Shirt', // product name

'Green Medium', // category or variation

'11.99', // unit price - required

'1' // quantity - required

]);

_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>

</head>

<body>

 

Thank you for your order. You will receive an email containing all your order details.

 

</body>

</html>

 

Thanks again for any and all help,

 

Jason

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...