How to add Google Analytics to the cart.
Posted by Steve Naqvi on 07 March 2009 12:07 AM
Note, this only tracks traffic and not sales has you need to use the following kb article to track sales.

Create a Google Analytics account      

Note to AdWords users: Google Analytics is able to import and track cost data from Google AdWords if your AdWords and Analytics accounts are linked. Please log in to your AdWords account and follow the instructions on the Analytics tab.
To create an Analytics account:

   1. Visit
   2. Enter your Google Account email and password and click Sign In. If you don't have a Google Account, click Sign up now to create one.
   3. Click Sign Up.
   4. Enter your Website's URL, making sure to select either http:// or https:// from the drop-down list. Enter a nickname for this account in the account Name field, then click Continue.
   5. Enter your contact information and click Continue.
   6. Read the Google Analytics Terms of Service. If you agree to these terms, select the Yes checkbox and click Create New Account to continue.

The Tracking Instructions page that appears contains the tracking code that you'll need to paste into each page of your site. We recommend completing some additional steps before pasting this code, however, to ensure that the data you collect is relevant.

Otherwise, click Continue on the Tracking Instructions page to access your new account.
Step 2 - Configure your profile      

It's important to configure your profile in order to get the most out of your reports. To access your profile settings:

   1. In the Website Profiles table, find the profile to edit.
   2. Click Edit. The Profile Settings page appears.
   3. Click Edit on the Main Website Profile Information table.

Default page
Setting this to the default (or index) page of your site allows Google Analytics to reconcile log entries for and, for example. These are in fact the same page, but are reported as two distinct pages until the Default Page setting has been configured.

Exclude URL Query Parameters
Does your site use dynamic session or user identifiers? You can tell Analytics to ignore these variables and not count them as unique pages. Enter any query parameters to exclude, separated with commas.
E-Commerce Website
To enable e-commerce reporting and the E-Commerce Analysis report set, select Yes.
Step 3 -  Add the tracking code to your pages

Google Analytics only tracks pages that contain the Google Analytics tracking code. You'll need to add this code to each page of your site, either manually or through the use of includes or other methods.

To access your tracking code:

   1. Sign in to Google Analytics.
   2. From the Analytics Settings page, find the profile for which you would like to retrieve the tracking code. Please note that tracking code is profile-specific.
   3. From that profile's Settings column, click Edit.
   4. At the top right of the Main Website Profile Information box, click Check Status.
   5. Your tracking code can be copied and pasted from the text box in the Instructions for adding tracking section.

Step 4 - Adding your tracking code to your shopping cart
  1.  Log into your admin area of the cart.
  2.  And Then go to 'Appearnace Settings'

3.  Then click on 'Edit Site Header and Footer' as shown below.

A sample of the code you will be pasting here would look similar to what is in the picture below.

Below is a sample of the code you would paste into the window above.  Make sure you place it before the final </table> but after all the other code on that page.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");

(138 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).