Setting up Google Analytics

Follow these steps to set up Google Analytics on your Shopify online store:

  1. Make sure you don't have Google Analytics enabled already.
  2. Get a Google account.
  3. Enable Google Analytics.
  4. Turn on ecommerce tracking.

Step 1: Make sure you don't have Google Analytics enabled already

Enabling Google Analytics more than once will result in inaccurate data. If you're sure you've never enabled Google Analytics for your store before, then skip to Step 2: Get a Google Account. If you aren't sure whether you've enabled Google Analytics for your store before, then follow these steps:

  1. From your Shopify admin, go to Online store > Preferences.
    Preferences button
  2. In the Google Analytics section, make sure that the box has only the text Paste your code from Google here, and is otherwise empty:
    Not enabled
    If you see this, then continue to the next step. If you see a code beginning with UA- instead, then you have Google Analytics enabled already and can skip to Step 4: Turn on ecommerce tracking.
  3. Click Themes:
    Themes button
  4. Click Actions > Edit code:
    Edit code in actions drop-down
  5. In the Layout section, click {/} theme.liquid:
    Location of theme.liquid file
  6. In the theme.liquid file, look for any of the following Google Analytics tracking tags: ga.js, dc.js, gtag.js, or analytics.js. If you see any of these tags in your theme.liquid file, then you have Google Analytics enabled already and can skip to Step 4: Turn on ecommerce tracking.

If you don't see a tracking code in the Google Analytics section of your Preferences page, and you don't have a Google Analytics tracking tag in your theme.liquid file, then Google Analytics isn't enabled on your store. Continue to Step 2: Get a Google Account.

Step 2: Get a Google Account

You need a Google account to use Google Analytics. If you already use Google products, such as Gmail or Ads, then you can use the same account for Google Analytics.

If you don't already have an account for a Google product, then create a Google account. You don't have to use the Gmail account for anything other than signing in and out of Google Analytics.

After you have a Google account, continue to Step 3: Enable Google Analytics.

Step 3: Enable Google Analytics

The steps to enable Google Analytics depend on whether you've used your Google account to set up Google Analytics before:

How to enable Google Analytics if you've never used Google Analytics before

Steps:

  1. In a web browser, open Google Analytics.
  2. Choose the Google account you want to sign in with, or click Add account to sign in with a new Google account.
  3. Click Sign up:
    Google Analytics sign up button
  4. Choose Website and fill in the required information. Use your primary domain for the Website URL:
    Example Google Analytics setup page
  5. Click Get Tracking ID.
  6. Use the drop-down menu to select your country if it is not already selected, then click I Accept to acknowledge that you have read the terms of service.
  7. On the next page, you'll see a lot of information and options. The only thing you need is the Global Site Tag. Copy the global site tag to your clipboard by highlighting it and pressing ctrl+C on PC or command+C on Mac:
    Global site tag
  8. In a new browser tab, open your Shopify admin.
  9. Go to Online store > Preferences.
  10. In the Google Analytics section, paste your global site tag in the Google Analytics account field:
    Paste Google Analytics code here
    You'll know that Google Analytics is enabled on your online store when you see a code beginning with UA- under the Google Analytics account heading, like this:
    Google Analytics enabled

After you enable Google Analytics on your store, continue to Step 4: Turn on ecommerce tracking.

How to enable Google Analytics if you've set up Google Analytics before

Steps:

  1. In a web browser, open Google Analytics.
  2. Click SIGN IN and select Analytics in the drop-down menu.
  3. Choose the Google account you want to sign in with, or click Add account to sign in with a new Google account.
  4. Click ADMIN:
    Google Analytics ADMIN button
  5. Click + Create Account:
    Google Analytics create account button
  6. Choose Website and fill in the required information. Use your primary domain for the Website URL.
    Example Google Analytics setup page
  7. Click Get Tracking ID.
  8. Use the drop-down menu to select your country if it is not already selected, then click I Accept to acknowledge that you have read the terms of service.
  9. On the next page, you'll see a lot of information and options. The only thing you need is the Global Site Tag. Copy the global site tag to your clipboard by highlighting it and pressing ctrl+C on PC or command+C on Mac:
    Global site tag
  10. In a new browser tab, open your Shopify admin.
  11. Go to Online store > Preferences.
  12. In the Google Analytics section, paste your global site tag in the Google Analytics account field:
    Paste Google Analytics code here
    You'll know that Google Analytics is enabled on your online store when you see a code beginning with UA- under the Google Analytics account heading, like this:
    Google Analytics enabled

After you enable Google Analytics on your store, continue to Step 4: Turn on ecommerce tracking.

Step 4: Turn on ecommerce tracking

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

Turn on basic ecommerce tracking

Steps:

  1. In your Google Analytics account, click ADMIN:
    Google Analytics ADMIN button
  2. In the View menu, click Ecommerce Settings:
    Ecommerce settings
  3. Click the Enable Ecommerce toggle to turn it from OFF to ON.
    Ecommerce toggle

If you need more detailed tracking information, then you can turn on Enhanced Ecommerce tracking.

Turn on enhanced ecommerce tracking

Steps:

  1. Open your Shopify admin.
  2. Go to Online store > Preferences.
  3. In the Google Analytics section, click the Use Enhanced Ecommerce checkbox:
    Enhanced ecommerce
    If you're using an older version of Google Analytics, then you might need to click Upgrade to the latest version before you can click the Use Enhanced Ecommerce checkbox:
    Click to upgrade GA
  4. Click Save.
  5. In your Google Analytics account, click ADMIN:
  6. In the View menu, click Ecommerce Settings:
    Ecommerce settings
  7. Click the Enable Enhanced Ecommerce Reporting toggle to turn it from OFF to ON:
    Enhanced ecommerce toggle
  8. Click Save.

Ready to start selling with Shopify?

Try it free