How to Setup Google Analytics in Fresh Store
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic, currently as a platform inside the Google Marketing Platform brand.
If you wish to use Google Webmaster Tool to monitor your store's health and traffic, you must first verify that you are the owner of the store. There are a few different methods available to do this, however, we will be using the “Google Analytics” method.
Before you can do this, you must have a Google Analytics account and have added your website there. Follow this other guide on how to set up a Google Analytics account: https://freshlabs.link/how-to-create-a-google-analytics-account
Now you can start the Google Webmaster verification process.
1. Go to https://search.google.com/search-console/welcome?hl=en and choose the URL prefix.
2. Enter the URL of your store and press continue. The site will then verify the ownership.
3. Once done, it should show this message:
4. Click Go to Property
5. If you go to Settings >> Ownership Verification, it should that it's verified via Google Analytics.
6. Now if you wish to add more stores, go back to https://analytics.google.com/ and click on Admin.
7. On the Property column, click "+ Create Property"
8. Choose the Web option and click on "Continue"
9. Set up the needed information on the next page then click "Create".
Note: Click on Advanced where the red arrow points to select which property you would like to create. The most recent option is Google Analytics 4. The traditional one is Universal Analytics (UA-xxxxxxxxx-x). You can choose to create both.
If you chose to have the GA4, please take note of step 11.1. Otherwise, for the traditional UA code, please follow step 11.2.
10. The next page will show you the Tracking ID and the Global Site Tag (gtag.js)
11. Now you have 2 options. To add the Global site tag in the store's header by going to Settings >> Store Settings >> Custom CSS and Scripts (Right Side) or by going to Reports >> Google Analytics and click Authenticate.
11.1. Using the Global Tag:
11.2. Via Google Analytics Authentication:
11.2.a. Click Allow
11.2.b. Get the Auth code on the next page:
11.2.c. Paste in the Auth page and click on Submit
11.2.d. Click on the drop-down and choose the name of the store
11.2.e. The Active profile number should match with what you have in your Google Analytics account