Often people ask how they can set up a Google Analytics Cross-Domain tracking system.
You, too, may have heard of or encountered the above settings. But the information on how to go about them remains uncommon.
Setting up a cross-domain tracking system is a fairly complex process. This post will look at how to set up Google Analytics Cross-Domain tracking, test if it’s working, and what it exactly is.
But first, let’s get to know what cross-domain tracking is.
What Is Cross-Domain Tracking
It is a way of sending information reserved in the browser cookies from one domain to another. Owing to the web browsers’ one-origin policy, a browser cookie is just accessible to the domain on which it is written as well as its subdomains, by default. Because Google Analytics utilizes cookies to maintain the Client ID, immediately the user progresses from one domain to the other, it’s significant to ratify the Client ID as well.
How to Set-up Google Analytics Cross-Domain Tracking System
For instance, you opt to create a campaign to gather users that enjoy digital marketing. So you buy liberating freelance.com and begin to decorate the site using the best guides on debauchery. To add it to your other site.
To explain further, the user experience will most likely be confusing to the users visiting liberating freelance.com and the other site.
To remedy the situation, you’ll have to set up a Cross-Domain Tracking system.
Although similar to sub-domain tracking, cross-domain tracking is a bit easy in theory but involves some nuance in particular strategies.
Here’s the idea, Google Analytics obtains a Client-ID value in each hit that is reserved in cookies. Cookies are compiled on a per-domain basis, and sites on the same domain can’t get cookies set on the other domain.
However, if you are tracking various domains, you need to switch the Client-ID value from one domain to the other. To achieve that, Google Analytics gives a linking feature that allows the original domain to be in place for the Client-ID in the parameters of the URL of a link. Where the destination domain can get it.
So here’s the procedure for cross-domain tracking:
- Modify your tracking code
- Set up referral excerpt
But in case you have a hard coding GA on your site, here’s how you can put things in place:
You have to set up a property in your Google Analytics account. You will then utilize a similar tracking code and ID for your various domains—both the trendy sport.com and the other site.
What to do:
- Establish a property and utilize a Tracking ID across domains.
- Revise the tracking code snippet. You’ll have to add some lines of code. Get the “create” link, which is similar to this:
ga(‘create’, ‘UA-XXXXXXX-X’, ‘example-1.com’); Then, create the. example-1.com’);
Then, build these changes.
ga(‘create’, ‘UA-XXXXXXX-X’, ‘auto’, {‘allowLinker’: true});
ga(‘require’, ‘linker’);
ga(‘linker:autoLink’, [‘site2.com’] );
You’ll use your Tracking ID and Domains within your performance. After that, this code is what you will place on your first domain.
You will need to repeat the same procedure to get a tracking code for the next domain, only that you’ll switch the domain in the code.
(use¹ site1.com instead of site2.com).
ga(‘create’, ‘UA-XXXXXXX-X’, ‘auto’, {‘allowLinker’: true});ga(‘require’, ‘linker’);
ga(‘linker:autoLink’, [‘site1.com’] );
Next, you’ll set up the referral exclusions as well as filtered views
Then move to Google Tag Manager to do the following:
Set up the Constant Variable.
In the Google Tag Manager.
Set up a current Variable.
You’ll have to choose a Constant Variable from the permitted list of Variables.
Next, key in the domains you would love to link separating them with commas in between.
Add the Domains
Then you’ll add your current Variable to your recent Google Analytics Pageview tag.
Then the next steps will be simple, add the variable to your set Pageview tag on your property.
Next thing, get to the “Cross-Domain Tracking” menu below the “More Settings” dropdown menu. Then key it into the “Auto Link Domains” field,
Set the allowLinker field to “true.”
Maintain your position in Google Tag Manager and get “Fields to Set” below “More Setting.” Set the Field Name to “allowLinker” and set the value to “true.”
Add to your Referral Exclusion List.
This applies to the Google Tag Manager setup and the hardcoded version we discussed previously.
It’s a critical bit because in case you miss setting up exclusions, find “self-referrals” or some duplicate sessions. Users will find it hard to shift between your two properties.
Just like with sub-domain tracking, you’ll first get to the Admin area of your Google Analytics account and get to the “Referral Exclusion List” below “Tracking Info.”
Then simply add the acceptable domains to your exclusion list. Liberating Freelance.Com in this case.
How to Test if Cross-Domain Tracking Is Working
Just in case cross-domain tracking is working, visits across the domains should be in a similar session and attributed to one Medium dimension.
To simply determine whether or not your cross-domain tracking is working in Google Analytics, browse the first domain by custom UTM parameters, similar to this:
www.domainA.com/?utm_source=xdom_test&utm_medium=xdom_test&utm_campaign=xdom_test
Next, browse for the first domain, launch a page with the iframe to the next domain.
After that, you apply a segment to include your custom In the Google Analytics View.
Google Analytics Cross-Domain FAQs
Can Google Analytics track across domains?
Cross-domain measurement is a Google Analytics feature that allows you to see sessions from two related sites (such as an eCommerce site and a separate shopping cart site) as a single session, rather than as two separate ones.10 Jun 2021
How does cross-domain tracking work in Google Analytics?
Google Analytics tag is designed to look for client ID in the query string and use it if it exists. So if a user has got the same client ID across two or more domains, then Google Analytics can identify the user across multiple domains
Does cross-domain need tracking?
Cross-domain tracking only applies if you have multiple domains. If you have a single domain with multiple subdomains, cross-domain tracking is not necessary
Do you need cross-domain tracking for subdomains?
Clear as day: “Tracking users across sub-domains does not require any additional configuration.” Also, some of the recent, excellent guides to cross-domain tracking, written by E-Nor and Bounteous enforce the same: you just need a default Universal Analytics Tag in Google Tag Manager
How do you implement cross-domain tracking?
To auto-link my domains, I select more settings in Google Tag Manager. Then, I navigate to the Cross-Domain Tracking dropdown. In the auto-linking field, I enter each of my domains in a comma-separated string. After I double-check my settings, I can save my progress to enable my changes
What is cross-domain access?
At its simplest, cross-domain access involves getting data from one website and displaying it within a page from a different website.
What are cross-domain issues?
This is a security restriction that prevents requests from being made from one origin to another. For example, it will prevent an https:// page from hitting an http:// address because the protocol is different. It will stop example.com from calling another.com because it is a different domain.
Why does the cross-origin error occur?
If the CORS configuration isn’t set up correctly, the browser console will present an error like “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at $somesite” indicating that the request was blocked due to violating the CORS security rules
How do you overcome cross-origin policy?
To fix CORS, you need to make sure that the API is sending proper headers (Access-Control-Allow-*). That’s why it’s not something you can fix in the UI, and that’s why it only causes an issue in the browser and not via curl: because it’s the browser that checks and eventually blocks the calls.29 Jul 2019.
Conclusion
So you now know how to set up a Google analytics cross-domain tracking and have the best answers to the frequently asked questions.
The best way to know whether you learned something or not, is by trying to implement it. Therefore, go ahead and practice what you’ve learned and save your sites’ visitors the confusion.