+44 7727 978782
ua
Submit Request

How to setup cross-domain tracking in Google Analytics 4

Cross-domain tracking on Google Analytics 4

Cross-domain tracking in UA is something you’re probably familiar with. Most configurations are done at the code level (e.g. In gtag.js or in GTM(GA tags). Many web analysts and marketers were confused by this confusion. Cross-domain tracking on Google Analytics 4 is much easier.

This guide will demonstrate how to set up cross-domain tracking in Google Analytics 4. We’ll first discuss the problem that cross-domain tracking solves, then we’ll move on to the actual configuration.

You don’t need an introduction? Jump to the configuration

If you’re already familiar with cross-domain tracking, then you can jump to this section. I’ll show you how to set it up in Google Analytics 4.

If you’re new to the subject, keep reading.

Multiple domains: The problem

This will make it very simple.

Google Analytics automatically tracks users using first-party cookies. When you land on a website, GA stores a “ga” cookie. Actually, GA stores more cookies but we will focus on the _ga that is stored in the visitor’s browser with some random identifier. Google Analytics monitors the cookie values as you navigate to pages A and B on your website.

GA knows that the cookie is still there (and the value is the same), so the second page view is included in the same session as the first page.

That’s awesome! You can use web analytics tools (not just GA) to track visitors’ usage of your website and what they are doing. Cookies, as technology have many drawbacks and are not perfect. Let’s just leave this topic for another blog.

Where is the problem?

Due to cross-domain policy, first-party cookies (created for your website) can’t be shared between different domains. Google Analytics on domainB.com won’t be able to recognize that a visitor is coming from domainA.com.

Google Analytics on domain A cannot reach certain cookies from domain A so it creates new cookies.

What is the result? Google Analytics (and other cookie-based web analytics tracking tools), will view you as two separate visitors on the domainA.com, and the domainB.com.

This is a huge problem. In your GA reports, will show too many users. Each person who visits domainA.com, as well as domainB.com, will become two users.

You can also track a new user and a session will start. In your traffic acquisition reports, you will see your domainA.com. This is known as “self-referral”.

cross-domain tracking

What should you do? Track across domains.

What is cross-domain tracking with Google Analytics 4?

It is a workaround that allows webmasters/marketers/analysts to send user’s/visitor’s identifiers from domain A to domain B and preserve the session information. This allows the visitor to be tracked across multiple websites/domains.

Both websites must use the same GA4 property in order to make this work.

cross-domain tracking

What is cross-domain tracking in Google Analytics 4?

This is the complete process.

Google Analytics 4 will send a special parameter to domainB.com when a visitor navigates between domainA.com and domainB.com. The GA on domainB.com can update Google Analytics 4 by using this parameter. It will also be able to understand that there is only one person who is navigating between two websites.

Google Analytics will track subdomains

Yes. You don’t need cross-domain tracking to do that.

You can track multiple websites belonging to the same domain, such as blog.yourwebsite.com. blog.yourwebsite.com and www.yourwebsite.com), Google Analytics 4 will handle that automatically.

If you search for “is subdomain considered cross-domain?” the result is NO.

How do you configure cross-domain tracking within Google Analytics 4

Okay, now that you have a better understanding of the problem and the solution, it is time to set it up.

Remember to follow one rule before you start: both websites (that are included in cross-domain tracking), must have the SAME GA4 property. You can either install the code directly on your site (tag), or via GTM. It is important to do this in the same property.

Step 1. Navigate to the Administration of Google Analytics > Data streams and choose a web data stream.

cross-domain tracking

Step #2. Go to More Tagging Settings.

cross-domain tracking

Step #3. Click Configure your domains.

how to set up a domain in google analytics

Step 4. Enter all domains to be included in the cross-domain tracking setup. Save the file.

how to set up cross-domain tracking google analytics finish

That’s all. This is all you need. GA will take care of that.

Note: If you run Universal Analytics on a website, you must remember something. Both GA versions share the _ga cookie. Your cross-domain configuration in Google Analytics 4 admin must match the settings for Universal Analytics. This means that the domains used in both configurations should match.

This will also impact your automatic outbound clicking tracking in enhanced Measurement. You will no longer be treated as an outbound click for domains you enter here.

Check the setup

After saving your changes, wait a while and then go to domainA.com. You will need to create a link on that website that redirects the visitor to domainB.com.

Click it. After you have been redirected to the second domain, verify the URL. You should include the _gl= parameter and a lot of other stuff.

second domain check

You can then enable the GA Debugger extension, and go to the DebugView section of Google Analytics 4. Once you’ve done that, you can find your device in the a href=”https://www.analyticsmania.com/post/debugview-in-google-analytics-4/”>DebugView section of Google Analytics 4. In some cases, page_location parameter may contain the domainA.com. In other cases, it will contain domainB.com.

This is what you should be looking at.

Remember the redirects

DomainB.com URLs that do not contain _gl parameters might have a JavaScript redirect. To identify issues, use the extension Redirect path.

After installing the plugin, go to domainA.com to click on the link to domainB.com. Click on the Extension Redirect Path to check if the parameter _gl was present. You should contact your developers to verify that it was there at first. This is where you want to keep the _gl parameter.

errors in domain redirection

Questions frequently asked

Although some of these questions are already answered in the blog post, I will list them here because not everyone reads every sentence. Here’s the TL-DR version.

 

What is cross-domain tracking with Google Analytics 4?

It is a workaround that allows webmasters/marketers/analysts to send user’s/visitor’s identifiers from domain A to domain B and preserve the session information. This allows the visitor to be tracked across multiple websites/domains.

 

Why is cross-domain tracking important?

It is essential to ensure that your visitors are accurate and increase in number. The number of sessions will also increase as the visitor navigates to a second domain. A new session will be initiated (because GA considers this a different user).

Is cross-domain tracking necessary for subdomains

If you’re referring to subdomains of the domain, no. Google Analytics 4 (and earlier versions) can track visitors across subdomains. You don’t need any extra configuration.

What do I need to do to set up the referral exclusion for cross-domain tracking with Google Analytics 4

No. Google Analytics 4 automatically handles self-referrals based on domains you have entered in the section “Configure Your Domains” ( source). Referral exclusion lists are required for things such as payment gateway domains.

How can I test cross-domain tracking?

Click the link on the first site to verify cross-domain setup. It will redirect you to the second site. The URL of the second website must contain the _gl= parameter. You can also check the _ga cookie to confirm.

Check both domains using the screenshot below. Both domains must have the same _ga cookie value. Keep an eye on “Domain” in the cookie list.

testing interagency tracking

Google Analytics 4 Cross Domain Tracking – Final words

Cross-domain tracking in GA4 is easier than Universal Analytics. There is no allowLinker nor Auto Link domains.

Go to the administrator of your GA4 property >Data streams and set up your domains in Web Stream.

Google Analytics 4 is clearly showing the direction Google is heading: less configuration in code or GTM and more in the GA4 interface. However, this does not mean that GTM is no longer necessary. Google Tag Manager is still necessary for many purposes.

Google Analytics 4: What you need to know about the new analytics

Google Analytics 4: What you need to know about the new analytics

When the button for switching to the GA4 resource appeared in the Google Analytics interface, everyone abruptly started discussing this topic, though the “App and Site” resources were available long ago. Everyone was just sure that it was necessary only for those ones who have both an app and a website.

First of all, you shall take into account the following:

Universal resources are still alive, it is better to use them together with GA4. When creating a new resource, you can select both types. Why you should not completely switch to the new type:

  • Since the tool is new, not all functions work perfectly yet, and there can be occasional failures.
  • If you use integration with services, in most cases it is not yet adapted to the resources of this type.
  • Not all functions are available yet, they are added step-by-step.
  • If the previous version of analytics was based on the page view, the new version is based on events and their parameters. Therefore, some indicators have disappeared.
  • There are no views in this version. There is an account, a resource, and data streams.

In general, the analytics is more user-friendly than previous versions. More flexible settings, fewer unnecessary actions, very convenient tools for insights and smart search. Now let’s look at the main changes

EVENT TRACKING.

This is the main fundamental change in the new type of resources. Since the analytics is based on the events, a number of changes have been made. The types of referencing are not registered and are recorded as an event. Example of differences from the official help information.

Events no longer have a “category, action, label” structure. Parameters are registered for events.

There are 3 types of events: automatic (registered without additional configuration), recommended (these are also standard events, but you need to configure their tracking), and special (user events that you create yourself). You can add up to 500 of the latter, so before configuration you shall check the following: whether the events you need are registered automatically.

Have a look at the “improved statistics” tool at the link. You can also create and modify events based on their parameters. The question often arises how to transfer e-commerce from UA to GA4. The help has a detailed article about the differences.

ANALYSIS TOOL

This tool gives a huge advantage to the new analytics over the previous version. I think most users regularly have to face the need constantly to create custom reports, sometimes just to change a bit the set of indicators in a standard report. This is very inconvenient. Here you can create very flexible reports much faster, there is a gallery of ready-made solutions.

In order to use the ready-made templates, you need to go to the gallery.

INTEGRATIONS

In the new version, integration with Big Query is available. In UA, it was paid, but here it is free. There is also a more functional interaction of data from all Google services. For example, the “interested (engaged) view” conversion is available on YouTube.

For the present the third-party services and CMS are the main problem, not everyone has a ready-made integration. Therefore, if it is possible to make changes directly into the code, it is recommended to use this feature. For now, these issues should be actively monitored. In the help there is an article about transfer for CMS. Also at the time of writing of the article, there are instructions for connection on certain platforms:

  • Blogger
  • GoDaddy
  • Google Sites
  • Magento
  • Shopify
  • SquareSpace
  • Weebly
  • Wix
  • WordPress

You can see here how data import works. For the present we are waiting for the feature that will make it possible to import data on expenses from third-party systems.

DATA FILTERING, EXCLUSION OF TRAFFIC SOURCES, AND ATTRIBUTION (MOST POPULAR QUESTIONS)

There are much fewer filters in GA4 than in the previous version. There are no views in the analytics, so there arises a question about data filtering. It is possible that in the future it will be possible to open access to data streams, but for the present there is no analog for access to the view.

Filters that are available:

Google offers to replace the remaining filters with a comparison tool and event conversion. The feature of exclusion of traffic sources has already been added to the settings.

For attribution, Google recommends using the settings in the reports. When you import a conversion to an Advertisement, you can use only the last click attribution model, and maybe, it will be possible to change this after a some time.

ADVANTAGES

  1. Flexible configuration and user-friendly interface. In addition to the analysis and additional changes that you can make in each report, you shall pay attention to computer-aided instructions and NLP functions. Convenient hints, search and forecasts. A lot of unnecessary things are removed and the missing ones are added.
  2. The feature that allows more accurately to predict performance and create an audience based on the forecasts. It is also possible thanks to the computer-aided instructions.
  3. Convenient cross-platform tracking.
  4. More accurate tracking, that is based on device and user IDs (can also be configured), data security.
  5. Integrations

 

CONCLUSION

There are discussions in the Internet already for a long time about the fact that sooner or later everyone will have to switch for 100% to the new analytics. And the earlier it is installed, the more data will be collected, therefore, if there is such a possibility, it is better to integrate it now and use it in parallel with the UA and study it at a comfortable pace. Yes, the tool is new, many functions are being added for the present, but now it is actively worked on, you need to track the system news on the link.

Open->
to new

Start working with #UAATEAM

  • United States+1
  • Afghanistan (‫افغانستان‬‎)+93
  • Albania (Shqipëri)+355
  • Algeria (‫الجزائر‬‎)+213
  • American Samoa+1
  • Andorra+376
  • Angola+244
  • Anguilla+1
  • Antigua and Barbuda+1
  • Argentina+54
  • Armenia (Հայաստան)+374
  • Aruba+297
  • Australia+61
  • Austria (Österreich)+43
  • Azerbaijan (Azərbaycan)+994
  • Bahamas+1
  • Bahrain (‫البحرين‬‎)+973
  • Bangladesh (বাংলাদেশ)+880
  • Barbados+1
  • Belarus (Беларусь)+375
  • Belgium (België)+32
  • Belize+501
  • Benin (Bénin)+229
  • Bermuda+1
  • Bhutan (འབྲུག)+975
  • Bolivia+591
  • Bosnia and Herzegovina (Босна и Херцеговина)+387
  • Botswana+267
  • Brazil (Brasil)+55
  • British Indian Ocean Territory+246
  • British Virgin Islands+1
  • Brunei+673
  • Bulgaria (България)+359
  • Burkina Faso+226
  • Burundi (Uburundi)+257
  • Cambodia (កម្ពុជា)+855
  • Cameroon (Cameroun)+237
  • Canada+1
  • Cape Verde (Kabu Verdi)+238
  • Caribbean Netherlands+599
  • Cayman Islands+1
  • Central African Republic (République centrafricaine)+236
  • Chad (Tchad)+235
  • Chile+56
  • China (中国)+86
  • Christmas Island+61
  • Cocos (Keeling) Islands+61
  • Colombia+57
  • Comoros (‫جزر القمر‬‎)+269
  • Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)+243
  • Congo (Republic) (Congo-Brazzaville)+242
  • Cook Islands+682
  • Costa Rica+506
  • Côte d’Ivoire+225
  • Croatia (Hrvatska)+385
  • Cuba+53
  • Curaçao+599
  • Cyprus (Κύπρος)+357
  • Czech Republic (Česká republika)+420
  • Denmark (Danmark)+45
  • Djibouti+253
  • Dominica+1
  • Dominican Republic (República Dominicana)+1
  • Ecuador+593
  • Egypt (‫مصر‬‎)+20
  • El Salvador+503
  • Equatorial Guinea (Guinea Ecuatorial)+240
  • Eritrea+291
  • Estonia (Eesti)+372
  • Ethiopia+251
  • Falkland Islands (Islas Malvinas)+500
  • Faroe Islands (Føroyar)+298
  • Fiji+679
  • Finland (Suomi)+358
  • France+33
  • French Guiana (Guyane française)+594
  • French Polynesia (Polynésie française)+689
  • Gabon+241
  • Gambia+220
  • Georgia (საქართველო)+995
  • Germany (Deutschland)+49
  • Ghana (Gaana)+233
  • Gibraltar+350
  • Greece (Ελλάδα)+30
  • Greenland (Kalaallit Nunaat)+299
  • Grenada+1
  • Guadeloupe+590
  • Guam+1
  • Guatemala+502
  • Guernsey+44
  • Guinea (Guinée)+224
  • Guinea-Bissau (Guiné Bissau)+245
  • Guyana+592
  • Haiti+509
  • Honduras+504
  • Hong Kong (香港)+852
  • Hungary (Magyarország)+36
  • Iceland (Ísland)+354
  • India (भारत)+91
  • Indonesia+62
  • Iran (‫ایران‬‎)+98
  • Iraq (‫العراق‬‎)+964
  • Ireland+353
  • Isle of Man+44
  • Israel (‫ישראל‬‎)+972
  • Italy (Italia)+39
  • Jamaica+1
  • Japan (日本)+81
  • Jersey+44
  • Jordan (‫الأردن‬‎)+962
  • Kazakhstan (Казахстан)+7
  • Kenya+254
  • Kiribati+686
  • Kosovo+383
  • Kuwait (‫الكويت‬‎)+965
  • Kyrgyzstan (Кыргызстан)+996
  • Laos (ລາວ)+856
  • Latvia (Latvija)+371
  • Lebanon (‫لبنان‬‎)+961
  • Lesotho+266
  • Liberia+231
  • Libya (‫ليبيا‬‎)+218
  • Liechtenstein+423
  • Lithuania (Lietuva)+370
  • Luxembourg+352
  • Macau (澳門)+853
  • Macedonia (FYROM) (Македонија)+389
  • Madagascar (Madagasikara)+261
  • Malawi+265
  • Malaysia+60
  • Maldives+960
  • Mali+223
  • Malta+356
  • Marshall Islands+692
  • Martinique+596
  • Mauritania (‫موريتانيا‬‎)+222
  • Mauritius (Moris)+230
  • Mayotte+262
  • Mexico (México)+52
  • Micronesia+691
  • Moldova (Republica Moldova)+373
  • Monaco+377
  • Mongolia (Монгол)+976
  • Montenegro (Crna Gora)+382
  • Montserrat+1
  • Morocco (‫المغرب‬‎)+212
  • Mozambique (Moçambique)+258
  • Myanmar (Burma) (မြန်မာ)+95
  • Namibia (Namibië)+264
  • Nauru+674
  • Nepal (नेपाल)+977
  • Netherlands (Nederland)+31
  • New Caledonia (Nouvelle-Calédonie)+687
  • New Zealand+64
  • Nicaragua+505
  • Niger (Nijar)+227
  • Nigeria+234
  • Niue+683
  • Norfolk Island+672
  • North Korea (조선 민주주의 인민 공화국)+850
  • Northern Mariana Islands+1
  • Norway (Norge)+47
  • Oman (‫عُمان‬‎)+968
  • Pakistan (‫پاکستان‬‎)+92
  • Palau+680
  • Palestine (‫فلسطين‬‎)+970
  • Panama (Panamá)+507
  • Papua New Guinea+675
  • Paraguay+595
  • Peru (Perú)+51
  • Philippines+63
  • Poland (Polska)+48
  • Portugal+351
  • Puerto Rico+1
  • Qatar (‫قطر‬‎)+974
  • Réunion (La Réunion)+262
  • Romania (România)+40
  • Russia (Россия)+7
  • Rwanda+250
  • Saint Barthélemy+590
  • Saint Helena+290
  • Saint Kitts and Nevis+1
  • Saint Lucia+1
  • Saint Martin (Saint-Martin (partie française))+590
  • Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)+508
  • Saint Vincent and the Grenadines+1
  • Samoa+685
  • San Marino+378
  • São Tomé and Príncipe (São Tomé e Príncipe)+239
  • Saudi Arabia (‫المملكة العربية السعودية‬‎)+966
  • Senegal (Sénégal)+221
  • Serbia (Србија)+381
  • Seychelles+248
  • Sierra Leone+232
  • Singapore+65
  • Sint Maarten+1
  • Slovakia (Slovensko)+421
  • Slovenia (Slovenija)+386
  • Solomon Islands+677
  • Somalia (Soomaaliya)+252
  • South Africa+27
  • South Korea (대한민국)+82
  • South Sudan (‫جنوب السودان‬‎)+211
  • Spain (España)+34
  • Sri Lanka (ශ්‍රී ලංකාව)+94
  • Sudan (‫السودان‬‎)+249
  • Suriname+597
  • Svalbard and Jan Mayen+47
  • Swaziland+268
  • Sweden (Sverige)+46
  • Switzerland (Schweiz)+41
  • Syria (‫سوريا‬‎)+963
  • Taiwan (台灣)+886
  • Tajikistan+992
  • Tanzania+255
  • Thailand (ไทย)+66
  • Timor-Leste+670
  • Togo+228
  • Tokelau+690
  • Tonga+676
  • Trinidad and Tobago+1
  • Tunisia (‫تونس‬‎)+216
  • Turkey (Türkiye)+90
  • Turkmenistan+993
  • Turks and Caicos Islands+1
  • Tuvalu+688
  • U.S. Virgin Islands+1
  • Uganda+256
  • Ukraine (Україна)+380
  • United Arab Emirates (‫الإمارات العربية المتحدة‬‎)+971
  • United Kingdom+44
  • United States+1
  • Uruguay+598
  • Uzbekistan (Oʻzbekiston)+998
  • Vanuatu+678
  • Vatican City (Città del Vaticano)+39
  • Venezuela+58
  • Vietnam (Việt Nam)+84
  • Wallis and Futuna (Wallis-et-Futuna)+681
  • Western Sahara (‫الصحراء الغربية‬‎)+212
  • Yemen (‫اليمن‬‎)+967
  • Zambia+260
  • Zimbabwe+263
  • Åland Islands+358
Select a Service:
Please fill in all required form fields