YouTube videos that could help you do this task :
Cross-Domain Tracking with Google Tag Manager :
Goal: To set up a hostname filter in Google Analytics that will add your pageâs subdomain information to your reports.
Ideal Outcome: You should be able to easily and accurately analyze your traffic reports and immediately distinguish the traffic among your subdomains.
Prerequisites or requirements: You need to have Google Analytics running on your website and all your subdomains, if you havenât added it yet you can do so by following :
Adding Google Analytics to a site (using GTM)The specific steps on this SOP apply only to Universal Google Analytics (not Google Analytics 4). If you followed other ClickMinded SOPs to create your Google Analytics account or if you set up Google Analytics before October 2020 you most likely have a Universal Analytics property.
Why this is important: If your website has multiple subdomains, Google Analytics will aggregate data that has the same page path. Understanding which sessions belong to which subdomains will require you to go through a few extra steps every time youâre analyzing results. This filter adds the subdomain information straight to your reports.
Where this is done: In your Google Analytics account.
When this is done: Only once per view.
Who does this:
The person responsible for Analytics.
- SOP Update: Google Analytics 4
**Note: Google has released a new version of Google Analytics in October 2020, this new version can be set as a property alongside standard version âUniversal Analyticsâ. The âUniversal Analyticsâ properties will likely be supported by Google for years to come. Currently, all ClickMinded SOPs support Universal Analytics exclusively.
To make sure you can follow this step-by-step SOP make sure you have selected the Universal Analytics property once your Google Analytics account has been created.
- On the top left corner click on the Account Dropdown and select a view within your Universal Analytics property (Not the GA4 property):
**Note: You can identify your Universal Analytics property by noticing the âUA-â prefix in the Property ID below its name:
- Setting up Cross-domain tracking
Important:
- Some specific cases are outside of the scope of this SOP. If youâre using redirects between your domains, if your code is removing parameters from the URLs, or if you are using iframes this might not work for you.
- This SOP assumes you already have the same Google Analytics property set up in both domains.
Important #2: If you donât have Google Tag Manager set up on your website, you will want to follow the procedure covered in :
Adding Google Tag Manager to a WordPress Site- Go to http://tagmanager.google.com and sign in with your account details.
- Select the container that is set up on your website.
**Note: This SOP assumes youâre using the same container in both domains. If that is not the case you will need to perform these steps twice, one time for each of the containers.
- Click âVariablesâ â âNewâ
- Rename the variable
- Click âChoose a variable type to begin set-upâŠâ â âConstantâ
- Type the domains you will want to link, separated by commas.
**Note: If you want to setup cross-domain tracking for all the domains and subdomains you only need to input your main domain. If you only want to implement cross-domain tracking between a few subdomains you should enter your subdomains instead.
Example:
- [asiteaboutemojis.com, anothersiteaboutemojis.com] will work for all these cases:
- User arrives at asiteaboutemojis.com and clicks a link to anothersiteaboutemojis.com;
- User arrives at shop.asiteaboutemojis.com and clicks a link to tools.anothersiteaboutemojis.com;
- [shop.asiteaboutemojis.com, course.anothersiteaboutemojis.com] will implement cross-domain tracking for this case:
- User arrives at shop.asiteaboutemojis.com and clicks a link to course.anothersiteaboutemojis.com;
But will not work for:
- User arrives at asiteaboutemojis.com and clicks a link to anothersiteaboutemojis.com;
- Click âSaveâ:
- Locate your Google Analytics settings variable, in your list of variables. It should have its type set to âGoogle Analytics settingsâ. Click that variable.
**Note: If you canât find this variable your setup might not be using it. If that is the case it is recommended that you start using it. You can refer back to SOP 009 to understand how you can configure your variable.
- Click âMore Settingsâ â âCross Domain Trackingâ:
- In the field âAuto Link Domainsâ click the â+â icon and select the variable youâve just created. In Step 4 of this SOP.
- Set the field âDecorate Formsâ to âTrueâ.
- Still under âMore Settingsâ â click âFields to Setâ â â+ Add Fieldâ:
- Add these settings:
- Field Name: allowLinker
- Value: true
- Click âSaveâ on the top right corner:
- If you now click on âOverviewâ on the sidebar, this is how your Google Tag Manager overview dashboard should look like:
- If everything looks ok, you are now ready to hit âSubmitâ
- In the âSubmission Configurationâ panel you will be given the chance to add a name and description to this version. After you have done so, hit âPublishâ.
**Note: Adding a name and description is optional but recommended. You should enter information here that will make it easy to know what changes are being made.
- Thatâs it! You will now be taken to see the summary of the changes youâve just made:
- Adding your new domain to the referral exclusion list:
- Open your Google Analytics account settings by clicking here or clicking âAdminâ in the sidebar.
- Select the correct Google Analytics Account and Property
- Click âTracking Infoâ â âReferral Exclusion Listâ
- You should see your root domain on the list:
- Click â+Add Referral Exclusionâ
- Type your new domain:
- Click âCreateâ, and thatâs it! You should now see your other domain in the Referral Exclusion List:
- Checking if cross-domain tracking is working as intended
- Open your website using Chrome and navigate to one of the pages in your first
- Click on the Google Tag Assistant Chrome extension and click âRecordâ:
- Refresh your page.
- Click any link pointing to your second domain.
**Note: Make sure the link you are clicking on opens in the same tab and not a new one, otherwise the Google Tag Assistant recording might not record you whole session.
**Note 2: You should see a â_gaâ parameter being added to the URL.
- Once the page loads click again on the Google Tag Assistant Chrome extension and click âStop Recordingâ and then click âShow Full Reportâ:
âŻ
- Select âGoogle Analytics Reportâ:
- Select the view that you want to test and click âOkâ:
- Check the âAlertsâ section and make sure youâre not seeing an alert regarding the Cross Domain implementation.
- Scroll down in the report until you find the âFlowâ section. You should see at least 2 Page loads there:
- Click âPage load 1â â The âURLâ field should be an URL belonging to your first domain.
- Click âPage load 2â â The âURLâ field should be an URL belonging to your second domain.
**Note: This is how an alert would look like If you had one:
- Thatâs it, if everything looks good your property will start collecting data correctly from both domains.
- Adding a Hostname filter to include your subdomain data
**Note: This is an optional step and depending on your current Google Analytics setup it might impact other configurations such as custom reports and goals.
- Log In to your Google Analytics account.
- Check If you already have a filter implemented, you can do so under filters, or by heading over to Behaviour â Site Content â All pages.
- If you have the standard set up you will see the page path in the reports:
**Note: By default Google Analytics will aggregate data from all the domains and subdomains, so you should bear in mind that in fact the page â/â is not only your main domainâs homepage but also the homepage of all your domains and subdomains being tracked by the same property if their homepages are also in the root of the subdomain.
- If you want to display the domain and subdomain information on your reports straight away, you can follow :
- Thatâs it. By the end of the SOP you will be seeing the domain and subdomain information straight on your reports: