Skip to content

Instantly share code, notes, and snippets.

@chandima
Created January 24, 2016 18:57
Show Gist options
  • Save chandima/85527aa54a02310d320f to your computer and use it in GitHub Desktop.
Save chandima/85527aa54a02310d320f to your computer and use it in GitHub Desktop.
ASU RFI E-Commer push JS code
// create named tracker
ga('create', 'UA-141599-1', 'auto', {'name': 'commerceTracker'});
ga('commerceTracker.require', 'ecommerce');
// push custom dimensions
ga('commerceTracker.set', {
'ASUOID': <asuoid>, // Push ASUOID
'RFI': 'asuo-rfi' // Push For segmenting on users who have submitted an RFI.
});
// push e-commerce
ga('commerceTracker.ecommerce:addTransaction', {
'id': <asuoid>, // Transaction ID. Required.
'affiliation': <affiliate>, // Affiliation or store name.
'revenue': 100, // Grand Total.
'shipping': 0, // Shipping.
'tax': 0 // Tax.
});
ga('commerceTracker.ecommerce:addItem', {
'id': <asuoid>, // Transaction ID. Required.
'sku': <progplancode-w-stub>, // SKU/code.
'name': <progname-w-stub>, // Product name. Required.
'category': <crmdestination>, // Category or variation.
'price': 100, // Unit price.
'quantity': 1 // Quantity.
});
ga('commerceTracker.ecommerce:send');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment