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

Google Analytics and eCommerce Tracking 9.4.0.0. to 9.4.2.0


Google Analytics and Ecommerce Tracking for Version 9.4.x.x

Version 9.4 of AspDoNetStorefront now supports asynchronous ecommerce tracking using Universal Analytics (analytics.js). This version of Google Analytics in AspDotNetStorefront allows you to make modifications to the Google Analytics code without modifying core source code.

NOTE: To use this latest analytics code, your Google account will need to be set for Universal Analytics. To check the status of your GA account (Universal or Classic), you can check which JavaScript Library your tracking code is referencing. To do so, login to your Google Analytics account and click "Tracking Code" to see the tracking code snippet for a specific property. Look for ga.js or analytics.js referenced somewhere in the code. Classic Google Analytics properties reference ga.js and Universal Analytics properties reference analytics.js.
If your account requires upgrading, follow Step 1 in this guide.
If you do not see the upgrade option, review this information.


Google Analytics

Installing the xmlpackage in your template.

The new skin that ships with version 9.4 and higher has the xmlpackage already installed in the template so you can skip to the next section (Configuration) if you are using the newer skin.

You'll want to make sure that your template.master file found in Web/App_Templates/Skin_{YourSkinID} includes the following code just before the closing <head> tag.

	
	<aspdnsf:XmlPackage runat="server" PackageName="script.headclose" />
	

If you don't already have a reference to the xmlpackage control you'll also want to add that to the top of your template.master file just after the other controls references.

	
	<%@ Register TagPrefix="aspdnsf" TagName="XmlPackage" Src="~/Controls/XmlPackageControl.ascx" %>
	

This should leave the top of your template.master file looking something like this:

	
	<%@ Master Language="C#" AutoEventWireup="true" Inherits="AspDotNetStorefront.MasterPageBase" %>
	<%@ Register TagPrefix="aspdnsfc" Namespace="AspDotNetStorefrontControls" Assembly="AspDotNetStorefrontControls" %>
	<%@ Register TagPrefix="aspdnsf" TagName="XmlPackage" Src="~/Controls/XmlPackageControl.ascx" %>
	...
	<!DOCTYPE html>
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head id="Head1" runat="server">
		...
		<aspdnsf:XmlPackage runat="server" PackageName="script.headclose" />
	</head>
	

Configuration

First you will need your Google Analytics account number. You can find this code by logging into your Google Analytics account. The interface on Google Analytics changes frequently but you should find the number on the page where you get your tracking script. Copy the UA-xxxxxxxx-x number off of this page.

Your analytics number location

Once you've got the number navigate to admin side of your website and add the account number to the appconfig titled Google.AnalyticsAccount.

Add your analytics number to the appconfig

Lastly, make sure that the appconfig titled UseLiveTansactions is set to TRUE. This setting assures that Google Analytics only runs on your live website.

Set UseLiveTransactions to true

At this point you have completed the installation of Google Analytics. You should be able to view page source on the front end of your website and see the Google Analytics code.

Google Analytics Code

Google Analytics Ecommerce Tracking

If you would like to enable ecommerce tracking you just have two more steps to complete.

First login to your Google Analytics account and enable ecommerce tracking. The interface tends to change, but look under View(Profile) > View Settings

Enable ecommerce tracking

Next login to the admin side of your website and set the appconfig titled Google.EcomOrderTrackingEnabled to TRUE

Enable ecommerce tracking in AspDotNetStorefront admin

That's it! At this point your site will send order data up to Google Analytics when your customers check out.


Google Display Advertising

In version 9.4.2.0 a new AppConfig has been added to enable the Google Display Advertising parameter in the tracking code: Google.AnalyticsDisplayAdvertising.Enabled

When this is true, it will include the following line in your analytics javascript: ga('require', 'displayfeatures');


Supporting the old token style installation of Google Analytics

In version 9.4.0.0 and above we've officially deprecated support for the old token style implementations of Google Analytics.

To get those old tokens working again we have added a new appconfig titled Google.DeprecatedEcomTokens.Enabled

Enable ecommerce tracking in AspDotNetStorefront admin

For more information about using these tokens please see the old documentation

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.