Google Analytics


Google Analytics enables you to track the visitors to your store, and generates reports that will help you with your marketing.

Follow these instructions to enable Google Analytics through your general settings. We strongly recommend that you use only this method to enable Google Analytics on your website.

Before you begin

Before you begin, you'll need to:

Making sure Google Analytics isn't already enabled

In general, Google Analytics should only be enabled once, otherwise tracking will be inaccurate.

Unless you're just planning to upgrade a working installation to Universal Analytics, you must make sure that none of the following tracking scripts are present in your theme.liquid file:

  • ga.js
  • dc.js
  • analytics.js.

The presence of any of these scripts indicates that Google Analytics is already enabled on your site. Unless you're upgrading or have another specific reason to keep these scripts, we recommend removing them from your theme before you continue with these instructions.

To inspect your site and check for any potential problems, install Google's Tag Assistant. If there is an issue such as multiple tracking scripts, you'll see an error message when you visit your site, for example:

  • Error: Detected both ga.js and dc.js scripts which will make tracking ambiguous.
  • Multiple Google Analytics tags detected.

Getting a Google account

Before you can enable Google Analytics, you’ll need a Google account. If you already have a Gmail account, you'll be able to use that. If not, create your Google account here.

Enabling Analytics

Shopify officially supports and recommends using Universal Analytics, which is the latest version of Google Analytics.

Upgrade to Universal Analytics from Classic

Although Shopify also supports the usage of Classic (Asynchronous) Analytics, you should use Universal Analytics unless you have specific implementation requirements. Universal Analytics has all the functionality of Asynchronous Analytics in addition to new features.

If you're already running Classic Analytics, you can upgrade from your Online Store preferences in the Admin:

  1. Open your Shopify store Admin in a new browser window.

  2. From your Shopify admin, click Settings:

    Settings tab

  3. Click Online Store:

    Online store settings

  4. Scroll down to the Google Analytics section, then click Upgrade to the latest version.

Click to upgrade ga

Enable Universal Analytics

To enable Universal Google Analytics:

  1. Begin by going to the Google Analytics homepage and click the create an account link in the top right corner.

    Ga create account

  2. On the next page, click Sign in or create new account.

  3. Click Website, not Mobile app, and fill in the form. Enter your primary domain for the Web Site URL. The checkboxes at the bottom are not relevant.

    Click Get Tracking ID at the bottom of the page to complete signup.

    Ga tracking id

  4. On the next page, you'll see a lot of information and options. The only thing you need is the code snippet that Google provides. It looks similar to this:

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

ga('create', 'UA-########-#', '');
ga('send', 'pageview');

5. (Optional) You can find the code snippet at any time from your Google Analytics Admin. Choose Settings, then Tracking Info, and scroll down to find the tracking code.

6. Copy the code snippet to your clipboard by highlighting it and pressing Cmd-C (Ctrl-C on PC).

7. Open your Shopify store Admin in a new browser window.

8. From your Shopify admin, click Settings:

Settings admin

9. Click Online Store:

Online store admin

10. Paste your Tracking code into the Google Analytics account field.

Ga code field


Don't put any code in the add additional Javascript field unless you want to support Display Advertising.

11. Make sure you've removed password protection from your storefront, otherwise Google Analytics won't be able to track visitors.

Turning on Ecommerce tracking

You can implement Google's Ecommerce tracking at two different degrees of detail:

The code is added automatically, but you must enable Ecommerce tracking at the view level in Google Analytics, to ensure that Ecommerce data is included in your reports.

Enable basic ecommerce tracking

  1. Click Admin from the menu bar at the top of any screen in Google Analytics.
  2. Use the drop-down menus to select the Account, Property, and View that you want to track.

    Ecommerce settings

  3. Click Ecommerce Settings.

  4. At Step 1 of the Ecommerce setup, click the Enable Ecommerce Status toggle to ON.

    Enable basic ecommerce tracking

Your basic setup is complete. If you need more detailed tracking information, you can enable Enhanced Ecommerce tracking.

Enable Enhanced Ecommerce tracking


This feature is available only if you're using Universal Analytics and responsive checkout.

To enable Google's Enhanced Ecommerce tracking:

  1. From your Shopify admin, click Settings:

    Settings tab

  2. Click Online Store:

    Online store settings

  3. Scroll down to the Google Analytics section and click the Use Enhanced Ecommerce checkbox.

    Use enhanced ecommerce checkbox

    Unless you're running the latest version of Google Analytics, you'll have to click Upgrade to the latest version:

    Click to upgrade ga

    If you're not using a responsive checkout, you'll also need to click upgrade to Responsive Checkout:

    Upgrade to responsive

  4. Click Save.

  5. In Google Analytics, click Admin from the menu bar at the top of any screen.

  6. Use the drop-down menus to select the Account, Property, and View that you want to track.

    Ecommerce settings

  7. Click Ecommerce Settings.

  8. At Step 1 of the Ecommerce setup, click the Enable Ecommerce Status toggle to ON.

    Enable basic ecommerce tracking

  9. Click Next step.

  10. Click the Enable Enhanced Ecommerce Reporting toggle to ON.

    Enhanced ecom settings on

  11. Click Submit to complete the setup.

Excluding referrer domains


This feature is only available if you're using Universal Analytics.

To ensure that domains you don’t want attributed as referrals are excluded:

1. In your Google Analytics Admin, click on your Tracking Info.

Ga tracking info btn

2. Make sure you have the following domains in your Referral Exclusion List:

  • (the primary domain of your site, you may have more than one)
  • (if you’re using PayPal)
  • any other external payment gateways you are using.

You can read more about referral exclusions here.

Supporting Display Advertising

After you've enabled Google Analytics in your store, you might also want to support Display Advertising:

1. Go to the Settings > General page in your Shopify Admin, and find the Google Analytics section.

2 Copy+paste the following code in the Additional Google Analytics Javascript field:

ga('require', 'displayfeatures');
Ga remarketing code

3. Be sure to update your store’s privacy policy if necessary.


Read more from Google about Display Advertising here.

Goals and Funnels

Check out this article about Goals and Funnels in Google Analytics.

Discrepancies in reporting

It’s not unusual to notice discrepancies between the traffic reported in your Shopify admin and the data provided by Google Analytics. Unfortunately, it’s impossible to know exactly how to account for these differences and resolve the discrepancy.

There are many possible reasons for differences in tracking results, including:

  • Differences in how page reloads and unique visitors are counted. Google counts every page reload, but a browser won’t count reloads of cached pages.
  • Differences in how page visits are defined. For example, some analytics software counts search bots as visitors, while other software doesn’t.
  • Google can only count visitors with javascript and cookies enabled. Some visitors might not allow cookies or javascript.
  • Discrepancies might be introduced because of different reporting timezones. Read about changing your Google time zone here.
  • It’s unlikely that identical tracking mechanisms are being used, so your visitors will not be recorded equally. Details of recording mechanisms are proprietary information and are never shared.

Ready to put what you've learned into action?

Build an online store with Shopify. Try it free.

Experience the future of retail now.

Shopify Point of Sale. Try it free.