Step 1: Create a Google Analytics Account
Before you can add Google Analytics to your Shopify website, you must create a Google Analytics account.
To create a Google Analytics account:
- Visit the Google Analytics website.
- Either sign in to your Google account or create a new one, then click on the blue “Start measuring” button.
- In the “Account name” field, enter an account. Typically, this will be the name of your business.
- Decide what data you want to share with Google, and then click on the “Next” button.
- You’ll then arrive on a “Property details” screen. Your property name is the name of your website, and it is typically the same name as your business.
- In the “Property name” field, enter your property name, select your time zone and local currency, then click on the “Next” button.
- You’ll arrive on a “Business information” screen.
- Select your “Industry category” and “Business size.” Also, check the appropriate boxes under “How do you intend to use Google Analytics with your business?” and then click the “Create” button.
- Decide which email communications you want to receive regarding Google Analytics, check the appropriate boxes, then click the “Save” button.
- Under “Set up a data stream to start collecting data,” click on the “Web” button.
- Under “Website URL,” enter your website’s address, not including its security protocol.
- Under “Stream name,” enter the name of your website. Leave “Enhanced Measurement” turned on and click on the “Create stream” button.
- Scroll down to “Global site tag (gtag.js)” and click the down arrow icon to open a section of code.
- You will need to copy the entire block of code that appears by clicking the copy icon on the right side of the code box. Don’t let the word “code” scare you off — adding this to your website is simple and easy.
- Continue to Step 2.
Step 2: Connect Google Analytics to Your Shopify Site
Now that you have a Google Analytics account and copied the “Global site tag” code, it’s time to add this information to your Shopify website.
To connect your Google Analytics account to your Shopify website:
- Sign in to your Shopify account. You should automatically be navigated to your site’s main dashboard.
- From the dashboard, click on the “Online Store” button.
- Here, you will be able to see a preview of your current theme.
- Click “Actions” and then click “Edit code.” to continue.
- Locate “theme.liquid” under “Layout” and click to continue.
- Click where it says “<Head>” on line 3.
- Click the enter key three times to add three additional lines below line 3.
- Click on line 4, then paste the code you copied earlier.
- Click the green “Save” button in the top-right corner to finish your work.
Congratulations! You’ve connected your Google Analytics account to your Shopify website. However, bear in mind that you may have to wait 24 to 48 hours for site data to start showing up in your Google Analytics account.
Step 3: Confirm the Connection to Shopify
Finally, you should make sure you connected your Google Analytics account to your Shopify website correctly.
To confirm the connection:
- Open your Shopify website — not your website editor, but the browser version of your website.
- In a new tab, go to the Google Analytics website and log in to your account.
- Click on the “Realtime” option in the menu on the left.
Because you are currently visiting your website in another tab, the number “1” should appear under “Users in Last 30 Minutes.”
Google Analytics mentions that traffic may take up to 24 hours to appear in the Google Analytics dashboard. If your website still doesn’t show any traffic after 24 hours, repeat the steps in this article to ensure you were successful in adding Google Analytics to Shopify.