gaq_push is not defined: Google Analytics error
I've implement the new "Async" Google Analytics Snippet. Here is the snippet:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16558786-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
On my order page, I'm tracking transactions like so:
<!-- google receipt begin -->
<script language="JavaScript" type="text/javascript">
// total transaction
gaq_push._addTrans(
"[[DMI:Expression value='((Order)Container.DataItem).OrderNumber']][[/DMI:Expression]]", // order ID - required
"A.M. Leonard", // affiliation or store name
"[[DMI:Expression value='((Order)Container.DataItem).ItemTotal.ToString("0.00")']][[/DMI:Expression]]", // total - required
"[[DMI:Expression value='((Order)Container.DataItem).Tax.ToString("0.00")' ]][[/DMI:Expression]]", // tax
"[[DMI:Expression value='((Order)Container.DataItem).ShippingCost.ToString("0.00")' ]][[/DMI:Expression]]", // shipping
"[[DMI:Expression value='((Order)Container.DataItem).ShippingInfos[0].Address.City' ]][[/DMI:Expression]]", // city
"[[DMI:Expression value='((Order)Container.DataItem).ShippingInfos[0].Address.State' ]][[/DMI:Expression]]", // state or province
"[[DMI:Expression value='((Order)Container.DataItem).ShippingInfos[0].Address.Country' ]][[/DMI:Expression]]" // country
);
// all items
[[DMI:Use dmisource='((Order)Container.DataItem).Items']]
gaq_push._addItem(
"[[DMI:Expression value='((OrderItem)Container.DataItem).OrderNumber' ]][[/DMI:Expression]]", // order ID - necessary to associate item with transaction
"[[DMI:Expression value='((OrderItem)Container.DataItem).Sku' ]][[/DMI:Expression]]", // SKU/code - required
"[[DMI:Expression value='Core.URLEncode(((OrderItem)Container.DataItem).ProductName)' ]][[/DMI:Expression]]", // product name
"", // category or variation
"[[DMI:Expression value='((OrderItem)Container.DataItem).UnitPrice.ToString("0.00")' ]][[/DMI:Expression]]", // unit price - required
"[[DMI:Expression value='((OrderItem)Container.DataItem).QtyOrdered' ]][[/DMI:Expression]]" // quantity - required
);
[[/DMI:Use]]
gaq_push._trackTrans(); //submits transaction to the analytics servers
</script>
<!-- google receipt end -->
However,I am receiving an error that says: Uncaught ReferenceError: gaq_push is not defined
The DMI:Expression code is internal API code used for passing variables. As you can see, I'm passing in stuff like ItemTotal,Tax, etc. etc.
However, I believe the error is in the Transaction Tracking area. Any ideas?