Working with Google Analytics
Google Analytics enables you to track the visitors to your store, and generates reports that will help you with your marketing. We strongly recommend that you use only the method described here to enable Google Analytics on your website. There are a few reasons that you might see discrepancies between Google Analytics and Shopify Reports.
Before you begin
Before you begin, you'll need to:
- Make sure Google Analytics isn't already enabled on your site
- Get a Google account if you don't already have one
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:
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. You don't have to use the Gmail account for anything other than signing in and out of Google Analytics.
Shopify officially supports and recommends using Universal Analytics, which is the latest version of Google Analytics.