Category Archives: Analytics

1ShoppingCart & Google Analytics

google analytics header


Update – 3/5/2009 – I’ve been demo’ing the 1SC/Google Analytics integration quite a bit lately (to staff and others) and put together a little document to try and show the results of a successful implementation.  You can take a look at the document here!


On July 10, 2008 1ShoppingCart released a new Third Party Integration with Google Analytics to all Basic and Pro package accounts.

It’s a great feature that has been requested for ages and I’m happy to have been able to push it through.

Generally 1ShoppingCart doesn’t offer a ton of support or more than basic help information for our Third Party Integrations, typically letting each third party provider support their own products instead.

This usually isn’t an issue as most of our merchants using an integrated third party solution (henceforth referred to as TPS) tend to know more about that solution than we do. But Google Analytics seems to be a little bit different.

Not that we know more about Google Analytics than our merchants, but there is definitely a unique dynamic surrounding this particular integration that hasn’t occurred with any of our previous TPS integrations and I’ve been approached a few times for more information on how this new integration works

I’m sure that the major differentiator is simply that, while most of our TPSs are fairly specialized, Google Analytics is fairly mainstream and widely used (for obvious reasons… I use it myself!)

Anyway, I’ve talked to our support team about creating a guide of some sort, but in the meantime I thought I would clean up my notes and post them here as a short term solution.

*Disclosure: I don’t talk a lot about my great ‘day job’ here, so if I’m confusing any of you right now here’s the skinny: I’m a product manager for (a brand). There aren’t very many corners of the app that I haven’t had a heavy-hand in improving (and occasionally breaking – sorry about that) over the past few years and Google Analytics was one of my pet projects earlier this summer.

Google Analytics

google analytics example

This integration was pretty simple and straightforward, which is one of the major reasons I was able to sneak it into our busy development cycle.

The Basics

We took Google’s provided script and coded it right into our shopping cart process. The script itself is exactly the same for everyone using Google Analytics, with the exception of each user’s Unique Identifier (referred to within the script as the ‘UA’).

So all you have to do as a (Basic or Pro package) merchant of 1ShoppingCart is find your UA and type (or copy/paste) it into the Google Analytics field on the Setup >> Third Party Integrations menu within your account and then update your product links (to tell Google that the destination needs to be tracked also.)

The Slightly Tricky Stuff

The one caveat to this is:

You need to be using the CORRECT script on your own website to make this work… and you probably aren’t yet

Google provides 3 or 4 different scripts; there’s at least one legacy version (legacy=old… i.e. don’t use!) provided as an urchin.js file and 2 newer versions provided as ga.js files.

I’m not going to talk about the legacy version here other than to say: UPGRADE! The urchin.js file doesn’t even offer the same functionality as the newer versions, and it won’t work with the 1ShoppingCart Google Analytics Integration.

Of the two new versions, there is a standard version and another provided to ‘track a 3rd party shopping cart’ (that’s us!)

You’re most likely using the standard version on your site now (assuming you are using Google Analytics already of course) but will need to update your site to use the ‘track a 3rd party shopping cart’ version in order to use our Google Analytics integration.

The ‘track a 3rd party shopping cart’ Script

I included a link to Google’s help page at the bottom of this post; I pulled all my information from there but I’ve been told from less tech savvy people that Google’s pages are difficult to understand. I hope my explanation is a little easier to digest, but if not, just let me know!

1. Get the right Analytics Script – Copy the code that follows and paste it into all the pages on your site (typically you would do this one time in a standard, site-wide include; like a header).  This code must be placed ABOVE any product links, so don’t put it in your footer, or near the </body> tag which is often recommended:

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

2. Add your Personal Identifier to the script - In the code above, replace the (“UA-xxxxxx-x”) with your actually UA #. As I understand it, the #’s between the dashes represents your individual Google account, and the last # represents which site profile you are tracking.

You can find your UA within your existing script or within your Google Analytics account:

From the appropriate site profile within your Google account, click EDIT from the Settings column. At the top right of the Main Website Profile Information box, click Check Status. Your standard tracking code will appear in the text box that appears in the ‘Instructions For Adding Tracking’ section.

3. Update your product links – This step may be a bit of pain for any merchants with a large number of products… sorry, but it’s the only way.

You have to add the following to the end of every link on your website that sends traffic to your shoppingcart on our site (again, make sure any links with this addition are LOWER in your code than the main analytics tracking javascript):

onclick=”pageTracker._link(this.href); return false;”

So, if your link looks like this currently (These are some test products on one of my accounts!):

<a href=””> Buy Me </a>

It should look like this, after you add the new bits:

<a href=”” onclick=”pageTracker._link(this.href); return false;”> Buy Me </a>

4. Test that you did it right – When I was poking around I came across a service that offers Google Analytics Site Scans. If you have any doubts about whether or not you installed the Google script correctly, head over to and see!

5. Watch your stats roll in!


If you want to go to the source, I’ve included links to pretty much all of the pages I visited to find the above information:

Google Analytics Site Scan:

Tracking Transactions:

Google analytics on an ecommerce site:

tracking a 3rd part shopping cart:

Confirm tracking code on site is correct:

*** Update 9/5/2008 – Apparently I forgot to talk about the all important aspect of Google Analytics Ecommerce Tracking… so I wrote another post.

*** Updated 2/2/2009 – I needed to clarify where in the code the main tracking script needs to be added.  It must go ABOVE any product links that include the _link parameter.

Firefox is the #1 Browser

I was just glancing through some of the analytics for this domain ( and noticed that Firefox has taken over as the number one browser being used by visitors.

And firefox didn’t just slide ahead, it blew by IE usage!

So either Firefox is taking a huge market share nowadays (and I love the new betas of 3 (other than the fact that my plugins don’t work)! So keep it up FF!) or I am attracting more and more of the geeky side of the interwebs.   :)

Either way, Firefox rocks this blog!

FireFox rocks this blog