26 Apr 2024 
Support Center » Knowledgebase » How do track my sales using Google Analytics?
 How do track my sales using Google Analytics?
Solution Google provides you with a code snippet to be placed on the Thank-You page (completed.html) of your cart to track sales through Google Analytics.

This code looks something similar to this:
<body onLoad="javascript:__utmSetTrans()">

<form style="display:none;" name="utmform">
<textarea id="utmtrans">UTM:T|[order-id]|[affiliation]|
[total]|[tax]| [shipping]|[city]|[state]|[country] UTM:I|[order-id]|
[sku/code]|[productname]|[category]|[price]|
[quantity] </textarea>
</form>

The shopping cart requires some slight adjustments to track sales information within it's system.


Please make the changes outlined below, or simply copy and paste the snippet below into the completed.html page found in the /content/skins area of File Manager.

MAKE SURE YOU REPLACE YOUR TRACKER ID WITH THE CODE PROVIDE FEOM YOUR GOOGLE ACCOUNT.

<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">
var pageTracker = _gat._getTracker("UA-xxxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();

pageTracker._addTrans(
"{$order_id}", // Order ID
"{$affiliation}", // Affiliation
"{$order_amount}", // Total
"{$tax}", // Tax
"{$shipping_amount}", // Shipping
"{$city}", // City
"{$region}", // State
"{$country}" // Country
);


{foreach from=$items item="item"}

pageTracker._addItem(
"{$order_id}", // Order ID
"{$item.sku}", // SKU
"{$item.product_name}", // Product Name
"{$item.catalog_name}", // Category
"{$item.price}", // Price
"{$item.quantity}" // Quantity
);

{/foreach}

pageTracker._trackTrans();
</script>


Article Details
Article ID: 20
Created On: 06 Oct 2008 03:00 PM

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Troubleshooter | News
Language:

Help Desk Software Help Desk Software By Kayako SupportSuite v3.70.02