Skip to content

Instantly share code, notes, and snippets.

@matthewfitz
Created September 9, 2010 12:27
Show Gist options
  • Save matthewfitz/571804 to your computer and use it in GitHub Desktop.
Save matthewfitz/571804 to your computer and use it in GitHub Desktop.
{% if thankspage %}
// Transaction
_gaq.push(['ShopOpenSkyTracker._addTrans',
'{{ order.orderNumber|escape('js') }}',
'{{ _view.user.getAttribute('checkout/referrerName')|escape('js') }}',
'{{ order.grandTotal|escape('js') }}',
'{{ order.taxAmount|escape('js') }}',
'{{ order.shippingAmount|escape('js') }}',
'{{ order.billingAddress.city|escape('js') }}',
'{{ order.billingAddress.state|escape('js') }}',
'US'
]);
// Items purchased
{% for item in order.items %}
_gaq.push(['ShopOpenSkyTracker._addItem',
'{{ order.orderNumber|escape('js') }}', // order ID - necessary to associate item with transaction
'{{ item.stockItem.openSkySku|escape('js') }}', // SKU/code - required
'{{ item.product.name|escape('js') }}', // product name
'', // category or variation
'{{ item.product.price|escape('js') }}', // unit price - required
'{{ item.qtyOrdered|escape('js') }}' // quantity - required
]);
{% endfor %}
_gaq.push(['ShopOpenSkyTracker._trackTrans']);
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment