Looking for the v10 manual? Visit our new user's guide!
 
Search Descriptions Version
 
 
This article applies to: ML v7

Google Analytics (urchin.js) and eCommerce Tracking


Synopsis
Google has recently started using a new javascript (ga.js) in place of the old one (urchin.js). Sites using ASPDNSF software prior to version 7.0.2.5 Service Pack 1 will have to keep using the old urchin code - see this page for details.

Procedure
There are basically 3 parts to the integration with Google's tracking tools:

- urchin.js script - This is a JS snippet inserted into your template file, which gives your site access to Google's JS functions
- Analytics - This is the core Analytics functionality, which tracks page hits, page referrals, conversions (if configured to), etc
- Conversion Tracking - This function tracks only conversions, as defined in your Google account (in this case, completed sales)

urchin.js script

Insert the following code into your template.ascx file before the </body> tag. This code will be inserted into every page on your site that inherits the storefront skin, allowing each page to use Google's Analytics functions.

<script src=https://ssl.google-analytics.com/urchin.js
type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-XXXXX-X";            
urchinTracker();
</script>

NOTE: Replace UA-XXXXX-X with your Google Analytics ID, obtained from Google.

Analytics

To enable ecommerce tracking on your site, add the skin token just before the </body> tag in your template.ascx page.

This will insert code similar to what is shown below into each page EXCEPT orderconfirmation.aspx (by default, see below for more info) to report page hits to Google. This information can be used for tracking ad campaign success, where customers abandon your site, etc. See here for more details on how to use this information.

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._initData();
pageTracker._trackPageview();
</script>

As mentioned previously, by default this code is put on every page except your final 'goal' page - in the case of this software, orderconfirmation.aspx. This means that while the basic Analytics tools show you page views, abandons, etc, they do not track full conversions. This can be altered by inserting that code into the final page as well. To do that, simply set the Google.EcomOrderTrackingEnabled AppConfig to true.

Conversion Tracking

Conversions, in the case of an ecommerce store, are completed sales. These are tracked by inserting special JS code into orderconfirmation.aspx - which customers will only see after finalizing their purchases. There are 2 steps to enable this tracking:

1 - Set the IncludeGoogleTrackingCode AppConfig to true.

2 - Edit the GoogleTrackingCode topic and replace 'YOURIDHERE' references (2 of them) with your Google Analytics ID.

NOTE: The Google tracking code will not display until you click the <> button to switch to HTML view.


Notes

    * - These features will only function with the storefront is in live mode (UseLiveTransactions AppConfig).

    * - Analytics and conversion results can take up to 24 hours after setup to begin appearing in your Google account.

    * - If you have enabled the Analytics conversion tracking (Google.EcomOrderTrackingEnabled) and standard conversion tracking, the numbers reported by those 2 features should be identical. If they vary, something is not configured properly.

Google Analytics and off-site payment methods such as PayPal

When using PayPal or other off-site payment methods the customer's original referral source can get overwritten, skewing the results. Please review this article to determine how to best handle this scenario.