You will need
- Go to your Shopify Admin, then Online Store, Preferences
- In the Google Analytics section, make sure that the field says "Paste your code from Google here". If there is no code in this field, proceed to the next step. If you see the code that starts with UA- instead, Google Analytics is already activated
Then, do the following:
- Go to Themes, then Actions > Edit Code
- In Layout click on
- Look for one of the following Google Analytics tracking tags in the
theme.liquidfile: ga.js, dc.js, gtag.js, or analytics.js
- If you see any of these tags in your theme.liquid file, you already have Google Analytics activated. You will need to remove existing code first before you proceed. See a discussion on this here
- You need a Google Analytics account. If you already have one, skip this step. To create an account, go to Google Analytics homepage and press "Sign up". If you already have a Google account, you can use it to sign in on this step
- The next screen gives you the option to choose between a website and a mobile app. Press "Website"
- Enter the Analytics account name, website name, site URL, select an industry category from the drop-down list, and scroll to the bottom of the page without changing the other checkboxes by default
- When signing up for a Google Analytics account, press the “Get Tracking ID” button. A pop-up window will appear, showing the Google Analytics Terms of Service. Read and, if these terms work, press the "Agree" button. You will be redirected to your Google Analytics account.
- The first time you visit your Analytics account, you'll be taken to the tracking information section of the website. Here you can see the tracking IDs and scripts to use for website tracking
- To find you tracking script in your Google Analytics account, press Admin, then Property, Tracking info, Tracking code
- Copy the tracking code between the
- Once you have a Google Analytics tracking code, sign into your Shopify account
- Open your Shopify Admin dashboard, then go to Online Store, Preferences
- Paste the Analytics tracking code in Google Analytics, Google Analytics account field
- Press Save. Done!
Google's E-Commerce tracking can be implemented at two different degrees of detail.
- Basic E-Commerce tracking when only transaction and revenue data is needed
- Enhanced E-Commerce tracking, when additional information about visitor behavior is needed For Basic E-Commerce tracking:
- From Google Analytics Admin, in View, press E-Commerce Settings
- Press Enable E-Commerce switch to toggle it from Off to On
To set up Enhanced E-Commerce tracking:
- On your Shopify Admin go to Online, then Preferences
- In the Google Analytics section, enable Use Enhanced E-Commerce option.
- If you are using an older version of Google Analytics, you may need to click Update to the Latest Version before checking the Use Enhanced E-Commerce checkbox
- Click Save. This allows Shopify to track all your website data and send it to Google Analytics.
- Now go to your Google Analytics Account, Admin, and in the View column
select Ecommerce Settings
- Press Enable Enhanced E-Commerce Reporting toggle to switch it from off to on. Then press Save
E-Commerce events tracked in your Google Analytics account, with reporting. First data appears within 24-48 hours from setting up tracking.