Setting up Google Analytics

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

Upgrade to Universal Analytics from Classic Analytics

Although Shopify also supports Classic Analytics, you should use Universal Analytics unless you have specific requirements. Universal Analytics does everything that Classic Analytics can do, and has more features.

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

  1. Open your Shopify admin in a new browser window.

  2. From your Shopify admin, click Online Store, and then click Preferences.

  3. 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. From the Google Analytics homepage, click Sign in.

  2. Click Analytics in the drop-drown menu.

  3. Choose the account you want to sign in with, or click Add account to sign in with a new Google account.

  4. On the next page, choose 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, so uncheck them all.

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

  5. On the next page, you'll see a lot of information and options. The only thing you need is the tracking ID code snippet that Google provides:

      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
    ga('create', 'UA-########-#', 'yourwebsite.com');
    ga('send', 'pageview');
    
  6. Copy the tracking ID code snippet to your clipboard by highlighting it and pressing ctrl+C on PC or command+C on Mac. You don't need to copy <script> or </script>.

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

  8. From your Shopify admin, click Online Store, and then click Preferences.

  9. Paste your tracking ID code snippet into the Google Analytics account field:

    Ga code field

    Note

    Don't enter any code in the Add custom Javascript field unless you want to support Display Advertising.

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

Tip

You can find your tracking ID code snippet at any time in your Google Analytics admin. To find it, open your Google Analytics Admin. Click Tracking Info, then scroll down to find the tracking code.

Turn 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 make sure that Ecommerce data is included in your reports.

Enable basic ecommerce tracking

  1. Click Admin in the Google Analytics menu bar.

  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

  1. From your Shopify admin, click Online Store, and then click Preferences.

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

    Use enhanced ecommerce checkbox

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

    Click to upgrade ga
  3. Click Save.

  4. Click Admin in the Google Analytics menu bar.

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

    Ecommerce settings
  6. Click Ecommerce Settings.

  7. At Step 1 of the Ecommerce setup, click the Enable Ecommerce Status toggle to ON. If you want to generate Related Products data, click the Related Products Status to ON.

  8. Click Next step.

  9. Click the Enable Enhanced Ecommerce Reporting toggle to ON:

    Enhanced ecom settings on
  10. Click Submit to complete the setup.

After you've enabled Google Analytics, you can enhance the implementation to get more reliable tracking data.

Support Display Advertising

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

  1. From your Shopify admin, click Online Store, and then click Preferences.

  2. Find the Google Analytics section, and copy and 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.

Tip

Read more from Google about Display Advertising here.

Want to discuss this page?

Visit the Shopify Community

Ready to start selling online with Shopify?

Try it free