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

Google Analytics and eCommerce Tracking

The storefront software allows store admins to easily integrate with Google's Analytics service. These features help you "find out what keywords attract your most desirable prospects, what advertising copy pulled the most responses, and what landing pages and content make the most money for you." (from Google's site. See their feature page for more information).

NOTE: In release MSx we have added built-in support for the asynchronous method of Google Analytics.


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

- ga.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
- eCommerce Tracking - This function tracks only conversions, as defined in your Google account (in this case, completed sales)

ga.js script

You can skip this step if using the GA Asynchronous method, as the ga.js is included automatically

If using the traditional method, insert the following code into your template.master file (don't forget to also place it in your Mobile skin template.master file) before the </head> tag. This code will be inserted into the top of every page on your site that inherits the storefront skin, allowing each page to use Google's Analytics functions.

<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"));



There are 2 steps to adding basic analytics to your site:

1 - Add the skin token in a literal wrapper: <asp:Literal ID="GA" runat="server" Text='<%$ Tokens:GOOGLE_ECOM_TRACKING_V2%>' /> just before the </body> tag in your template.master page (don't forget to also place it in all templates used on the site for all skins. Mobile is supported "out of the box" in version and up).

- In release MSx you can use the asynchronous method by using the token: <asp:Literal runat="server" ID="GA" Text='<%$ Tokens:GOOGLE_ECOM_TRACKING_ASYNCH%>' /> instead. If using this method, you cannot also use the traditional GA method. Place this token right before the </head> tag. There are some situations where you may need to place it in the body instead.

2 - Set the AppConfig: Google.AnalyticsAccount to your Google Analytics account ID (in the format of UA-XXXXXXX-X). This ID is obtained from Google.

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");




eCommerce 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. The steps in the Analytics section above will insert tracking code on every page except that orderconfirmation page. This means that while the basic Analytics tools show you page views, abandons, etc, they do not track full conversions. To do that, simply set the Google.EcomOrderTrackingEnabled AppConfig to true.

NOTE: Conversion tracking does not function on the mobile site prior to version "out of the box".


- 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's Ecommerce Tracking will not always work reliably for PayPal and PayPal Express transactions due to their lack of an API. Since the feature relies on javascript being executed on a page, and PayPal customers will not always actually hit a final page on your site (due to browser issues, redirects, IPN, etc), ecommerce tracking cannot track all PayPal orders.

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.