Created
January 9, 2014 05:18
-
-
Save gyan111/8329739 to your computer and use it in GitHub Desktop.
Reversing a google analytics ecommerce transaction, This code snippet should be added to the header.tpl in the ganalytics module.
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
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXX-X']); | |
_gaq.push(['_trackPageview']); | |
_gaq.push(['_addTrans', | |
'1234', // order ID - required | |
'Womens Apparel', // affiliation or store name | |
'-28.28', // total - required | |
'-1.29', // tax | |
'-15.00', // shipping | |
'San Jose', // city | |
'California', // state or province | |
'USA' // country | |
]); | |
_gaq.push(['_addItem', | |
'1234', // order ID - necessary to associate item with transaction | |
'DD44', // SKU/code - required | |
'T-Shirt', // product name | |
'Olive Medium', // category or variation | |
'11.99', // unit price - required | |
'-1' // item quantity - required | |
]); | |
_gaq.push(['_trackTrans']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment