Set up Google 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 and new 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 (or press G S W).

  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. 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 like this:

    <script>
    (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');
    </script>
    
  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 Online Store, and then click Preferences (or press G S W).

  9. Paste your Tracking code into the Google Analytics account field:

    Ga code field

    Note

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

  10. 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 make sure 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

To enable Google's Enhanced Ecommerce tracking:

  1. From your Shopify admin, click Online Store, and then click Preferences (or press G S W).

  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. In Google Analytics, click Admin from the menu bar at the top of any screen.

  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:

    Enable basic ecommerce tracking
  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.

Supporting 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 (or press G S W).

  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.

Did you know?

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