Bigcommerce and Google Analytics

For Visitor and Sales Tracking

BigCommerce has built in support for Google Analytics which includes the tracking of sales. Being able to see sales details within Google Analytics is very powerful. This enables you to analyse things like which sources are revenue generators or which parts of the website perform well at converting customers.

BigCommerce have now added support for Universal Analytics which is great. At this time I would recommend all stores to switch to Universal Analytics and the extra features it provided. This article now provides instructions for configuring BigCommerce to use Universal Analytics.

I offer a BigCommerce SEO Tune-up Services which includes setting this up for you amongst many other activities.

Video Tutorial for adding Google Analytics to Bigcommerce

This video is here to assist in the instructions from this article.

Set Up Your Google Analytics Account

If you don't have a Google Analytics Account for your website yet, then this is the time to create one. Follow the instructions to create a new account for your website. At some point you will reach the page where it asks you to insert the tracking code. That's where this all begins.

If you already have an account and it is upgraded to Universal Analytics then select the Admin tab, ensure your looking at the right Account and Property, then select Tracking Info->Tracking Code. We should all now be at the same place.

Modifying the Tracking Code for Bigcommerce

The following code is based on the the BigCommerce article called Setting Up Google Analytics.

    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    ga('create', 'UA-XXXXXXXX-X', 'auto');
    // ga('require', 'linkid');
    // ga('require', 'displayfeatures'); 
    ga('send', 'pageview');
    ga('require', 'ecommerce', 'ecommerce.js');
    function trackEcommerce() {
    this._addTrans = addTrans;
    this._addItem = addItems;
    this._trackTrans = trackTrans;
    function addTrans(orderID,store,total,tax,shipping,city,state,country) {
    ga('ecommerce:addTransaction', {
        'id': orderID,
        'affiliation': store,
        'revenue': total,
        'tax': tax,
        'shipping': shipping,
        'city': city,
        'state': state,
        'country': country
    function addItems(orderID,sku,product,variation,price,qty) {
    ga('ecommerce:addItem', {
        'id': orderID,
        'sku': sku,
        'name': product,
        'category': variation,
        'price': price,
        'quantity': qty
    function trackTrans() {
    var pageTracker = new trackEcommerce();

Take the code above and copy it into your favourite text editor so we can edit it.

The Tracking code you see in Google Analytics should look just like the start of the code above. Find the create line in the Analytics version and copy it's values into your local copy. That should replace the code I have highlighted in red.

I've added a few extra lines in our code which are shown in Blue and are commented out. If you wish to enable them then remove the // at the start of each line. This is what they do:

The linkid line is to enable Enhanced Link Attribution . This enables Analytics to not only detect page level links but also which link on the page caused a click. This enhancement improves the Behavior->In-Page Analytics report.

Support this work
I'd like to buy Tony a...

The displayfeatures line enables you to track Demographics and Interests of users as well as enables AdWords Remarketing. Note that to use this you need to make sure you have a Privacy Policy that tells people what you are doing. So only include it if you comply to the requirements.

Then follow these steps:

  1. Login to your BigCommerce Administration
  2. Click Setup & Tools (top right)
  3. Select Web analytics
  4. Switch to the Google Analytics tab (if it is not there select the check box to enable it)
  5. Insert your modified Tracking Code in the text box
  6. Click Save

In Google Analytics you should be able to instantly see traffic via the Real-Time tab. When you get orders you can also see sales in the Conversions->Ecommerce section.

Then check out my BigCommerce SEO Checklist for tips on how to further configure Google Analytics.

Please provide feedback if you have any issues or to tell me it worked perfectly.

Google Referral fix

If you use the PayPal Express Checkout payment method or any other payment system that works from outside your store, then you will have sales attribution issues because the external host (e.g. will take the credit for your sales (Tracking True Referrals when using PayPal). This is especially annoying if you want to see the value of any paid advertising.

To minimise this effect you can add to the Referral Exclusion List under Admin->Tracking Info->Referral Exclusion List.

Also make sure you have set your PayPal account to Auto Return so that Analytics can pick up the completed sale.