Last active
August 29, 2015 13:56
-
-
Save mahboob-awan/8851487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=========== E-commerce Tracking | |
//OLD | |
_gaq.push(['_addTrans', | |
'1234', // transaction ID - required | |
'Apple', // affiliation or store name | |
'465', // total - required | |
'1.29', // tax | |
'5' // shipping | |
]); | |
_gaq.push(['_addItem', | |
'1234', // transaction ID - required | |
'DD23444', // SKU/code - required | |
'iPhone 3G OLD', // product name | |
'Mobile Phones', // category or variation | |
'465', // unit price - required | |
'1' // quantity - required | |
]); | |
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers | |
//NEW | |
ga('ecommerce:addTransaction', { | |
'id': '1234', // Transaction ID. Required. | |
'affiliation': 'Apple', // Affiliation or store name. | |
'revenue': '465', // Grand Total. | |
'shipping': '5', // Shipping. | |
'tax': '1.29' // Tax. | |
}); | |
ga('ecommerce:addItem', { | |
'id': '1234', // Transaction ID. Required. | |
'name': 'iPhone 3G NEW', // Product name. Required. | |
'sku': 'DD23444', // SKU/code. | |
'category': 'Mobile Phones', // Category or variation. | |
'price': '465', // Unit price. | |
'quantity': '1' // Quantity. | |
}); | |
ga('ecommerce:send'); | |
ga('ecommerce:clear'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment