Is this Google Analytics e-commerce script correct?

by Thomas
2 replies
Hello Warriors:

Can anyone who is knowledgeable of such things tell me if I have got the format, etc. of the following Google Analytics e-commerce script correct? (Google's own explanation is pretty confusing!)

Btw, the "$receipt" will (hopefully!) be extracted from DLGuard. The other variables aren't required so I put nothing betwwn the quotation marks. Is this the correct way to do that? (Or can I simply delete those lines altogether?

Here's the script:
<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-XXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}
pageTracker._addTrans(
"$receipt",
"My Product Title Here",
"",
"",
"",
"",
"",
""
);
pageTracker._addItem(
"$receipt",
"",
"",
"",
"27.00",
"1"
);
pageTracker._trackTrans();
</script>
Thanks,
Tommy.
#analytics #correct #ecommerce #google #script
  • Profile picture of the author Thomas
    Originally Posted by Traffic-Bug View Post

    The has to be replaced by your server side code.
    I thought that was it: I put "$receipt" in it myself.

    In their example, Google have:
    "1234", // Order ID
    Regards,.
    Tommy.
    {{ DiscussionBoard.errors[660937].message }}

Trending Topics