Browse by Topic

Setting Up Google Analytics

Google Analytics is a free analytics tool that helps you track visitors and conversions on your store. To set up Google Analytics, you will need to create and verify your Google account.

We've updated our Google Analytics integration to support Enhanced Ecommerce and Site Search. We've also made the setup easier and code free — all you need is your Google Analytics property ID.

Those using the Cornerstone theme will not need to make any changes and can start using the integration right away. If you are using a Stencil theme other than Cornerstone, you will need to add Data Tags to your theme. If you are using a Blueprint theme, you will need to add Data Tags to your theme and check the Enable Data Tags checkbox during setup.


Manual Setup

These steps will show you how to set up Google Analytics for Ecommerce Tracking and how to implement the code into your store manually. There are a few notes to be aware before continuing.

  • This implementation does not support Enchanced Ecommerce.
  • This implementation method uses Google's analytics.js and not Global Site Tag (gtag.js).
  • You must have a dedicated SSL as this feature does not work with the shared SSL certificate.
  • If using the manual setup, Enable DataTags should not be enabled. See Installing the Tracking Code.

Setting up Google Analytics

Ecommerce Tracking

1. In your Google Analytics account, go to AdminViewEcommerce Settings.

Ecommerce Settings highlighed in the View list

2. Under Enable Ecommerce, toggle the status to ON and leave Enhanced Ecommerce Settings set to OFF. Save your changes.

Enable Ecommerce set to the ON state and the Save button highlighted

3. Copy the following tracking code. Be sure to copy the entire code, beginning with <script> and ending with </script>.

    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

    ga('create', 'UA-xxxxxxxx-x', '');
    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();

4. Continue to Installing the Tracking Code.


Installing the Tracking Code

Once you have successfully generated the tracking code, it will need to be installed in your BigCommerce store.

1. In the BigCommerce control panel, go to Advanced SettingsWeb Analytics.

2. Check the box next to Google Analytics, then Save.

Google Analytics checkbox

3. Click the Google Analytics tab that appears at the top of the page.

Google Analytics tab

4. Paste the tracking code into the Tracking Code field. Replace UA-xxxxxxxx-x and with your Google Tracking Number and your store's domain. If you are using a Blueprint theme, leave Enable DataTag disabled.

Example installation

5. Save your changes.


Excluding Referrals From Hosted Payment Gateways

To avoid transactions made through a hosted gateway such as PayPal appearing as referrals through Google Analytics, you will need to add the payment gateway to your Referral Exclusion List.

1. In your Google Analytics account, go to AdminPropertyTracking InfoReferral Exclusion List.

Tracking Info and Referral Exclusion List

2. Click Add Referral Exclusion.

Add Referral Exclusion

3. Enter the domain of your payment gateway (e.g. in the Domain field, then click Create to save your changes.

Domain field and Create button in the Referral Exlusion dashboard

Was this article helpful?