Skip to content

Instantly share code, notes, and snippets.


Created Jun 5, 2009
What would you like to do?
This is the newest way to do the GA order logging. It's been reported that there have been issues with this version and IE.
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
"[value mv_order_number]", // Order ID
"[data session source]", // Affiliation
"[total-cost noformat=1]", // Total
"[salestax noformat=1]", // Tax
"[shipping noformat=1]", // Shipping
"[either][value city][or][value b_city][/either]", // City
"[either][value state][or][value b_state][/either]", // State
"[either][value country][or][value b_country][/either]" // Country
"[value mv_order_number]", // Order ID
"[item-code]", // SKU
"[item-description]", // Product Name
"[item-field prod_group]", // Category
"[item-price noformat=1]", // Price
"[item-quantity]" // Quantity
} catch(err) {}</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment