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 a free Google account. We also recommend verifying your site with Google before starting the steps below.


Note: Google recently introduced a new web tagging library called Global Site Tag (gtag.js). BigCommerce does not support the Global Site Tag (gtag.js) at this time. You can continue to use your existing tracking setup and Google's Universal Analytics library (analytics.js) which this article is referencing.


Basic Tracking Code

These steps will show you how to set up basic tracking for a website and generate its tracking code in Google Analytics. If you wish to track additional metrics (e.g. conversion rate), skip ahead to E-commerce Tracking. Ecommerce tracking provides analytical data such as total revenue, the rate of conversions, and the number of unique purchases made.

1. Sign into or create your Google Analytics account.

2. Click Admin.

Admin button

3. Under Account, select Create a new account.

Create New Account

4. Complete the form, then click Get Tracking ID.

Get Tracking ID

5. Copy the following tracking 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-XXXXX-Y', 'auto');
    ga('send', 'pageview');

6. Proceed to Installing the Tracking Code.


E-commerce Tracking

If you wish to see E-commerce tracking in your Google Analytics reports, the code below should be entered instead of the basic tracking code.


E-commerce tracking: You must have a dedicated SSL as this feature does not work with the shared SSL certificate.

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

Ecommerce Settings

2. Under Enable Ecommerce, toggle the status to ON. Click Next Step.

Enable Ecommerce switch and Next step button

3. Leave Enhanced Ecommerce Settings set to OFF. Click Submit.

Enhanced Ecommerce Settings swtich and Submit button

4. 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();

5. 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.

Basic Tracking Code

Tracking Code

E-commerce Tracking Code

Google Analytics Ecommerce Tracking code pasted in the Tracking Code field

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 Rferral Exclusion List

2. Click Add Referral Exclusion.

Add Referral Exclusion

3. Enter the domain of your payment gateway (e.g. in the Domain field.

4. Click Create.

Was this article helpful?