Skip to content

Instantly share code, notes, and snippets.

/gist:123987

Created Jun 5, 2009
Embed
What would you like to do?
[comment]
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.
[/comment]
<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">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
pageTracker._addTrans(
"[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
);
[item-list]
pageTracker._addItem(
"[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
);
[/item-list]
pageTracker._trackTrans();
} catch(err) {}</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.