I'm trying to get Total cost of purchase, sku, city, etc. passed to google analytics. After enabling ecommerce in GA
I know the following code E-junkie code is not good enough....
<script type="text/javascript">
var gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");
document.write(unescape("%3Cscript src='"+gaJsHost+
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var ejGATracker = gat.getTracker("UA-XXXXX-X");
ejGATracker._setDomainName("none");
ejGATracker._setAllowLinker(true);
ejGATracker._trackPageview();
</script>
SO, I added the javascript part to it and it still does not work (the following):
<script type="text/javascript">
var gaJsHost=(("https:"==document.location.protocol)?
"https://ssl.":"http://www.");
document.write(unescape("%3Cscript src='"+gaJsHost+
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var ejGATracker = gat.getTracker("UA-796508-1");
ejGATracker._setDomainName("none");
ejGATracker._setAllowLinker(true);
ejGATracker._trackPageview();
pageTracker._addTrans(
"order-id", // required
"affiliate or store name",
"total",
"tax",
"shipping",
"city",
"state",
"country"
);
pageTracker._addItem(
"order-id", // required
"SKU",
"product name",
"product category",
"unit price", // required
"quantity" //required
);
pageTracker._trackTrans();
</script>
Does anyone know what I am missing?
Thanks!
Matt