Hello,
I'm having some challenges getting my google analytics tracking to work with e-Junkie's buy now buttons, and am hoping someone else has got this working and can point to my problems.
I want to use Google's event tracking to know when a user buys the book, I plan to do this via analytics tracking code inserted on the Thank You page but at the moment these are not showing up in my analytics reporting. The events to track the 'page views' and 'buy now' buttons are working fine.
Here is a sample of my analytics tracking code I'm using. I've included all the code from different pages as the problem could be in the _setAllowLinker or _setAllowHash tags.
Inserted into the section (working fine):
<script>var gaq = _gaq || []; _gaq.push(['setAccount', 'UA-XXXXXXXX-X']); gaq.push(['setDomainName', '.excelforpros.com']); gaq.push(['setAllowLinker', true]); gaq.push(['setAllowHash', false]); 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>
Inserted into the buy now button links (working fine):
onClick="gaq.push(['trackEvent', 'ebookpage', 'BuyNow', 'TopButton']);
And then the following code which I've inserted into the section of the thank you page on e-Junkie (this is not working):
<script>var gaq = _gaq || []; _gaq.push(['setAccount', 'UA-XXXXXXXX-X']); gaq.push(['setDomainName', '.excelforpros.com']); gaq.push(['setAllowHash',false]); gaq.push(['trackPageview']); gaq.push(['trackEvent', 'SaleComplete', 'e-Junkie', 'ThankYou', 25]); (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>
and inserted into an image file, in case the above doesn't work:
onLoad="gaq.push(['trackEvent', 'SaleComplete2', 'e-Junkie2', 'ThankYou2', 25]);
Thank you.