Over in Analytics, under the Ecommerce section, the Transactions view seems to be working fine, which as far as I can tell comes from the _addTrans portion of the code. The "quantity" column always shows 0, but we'll come to that in the next bit as that's not an _addTrans value.
The Product Performance area, though, shows absolutely no data. This is the stuff that should be coming from the _addItem chunk. Note that the quantity is hard-coded as "1" and that we already know the %%subscr_id%% variable works from the Transaction info. So, even if not all the information is getting through, at the very least the transactions should be showing a quantify of 1.
Based on that, I have to assume that the entire _addItem block is failing, but I can't see why. Has anyone else gotten this to work, and could you share your code? I'm using s2Member Pro 3.5.8 on WP 3.1.2
- Code: Select all
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
_gaq.push(['_setDomainName', '.example.com']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'%%subscr_id%%', // order ID - required
'Client Site Name', // affiliation or store name
'%%initial%%', // total - required
'', // tax
'', // shipping
'', // city
'', // state or province
'' // country
]);
// add item might be called for every item in the shopping cart
_gaq.push(['_addItem',
'%%subscr_id%%', // order ID - required
'%%item_number%%', // SKU/code - required
'%%item_name%%', // product name
'', // category or variation
'%%initial%%', // 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>