[UA] How the autoLink plugin works (analytics.js) [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

When you add the autoLink plugin to your tag, it automatically loads with your pages and performs a substring match on all your links. It then recognizes any links that include a domain name you’ve specified in your tag. Any traffic that clicks a link to those domains get counted as cross domain traffic unless the domain included in the link exactly matches the domain of the page.

For example, if you have set up cross domain measurement on example-1.com and example-2.com, the autoLink plugin recognizes links on example-1.com that go to example-2.com. When a user visits a page on example-1.com and clicks a link to example-2.com, the autoLink plugin counts the navigation as cross domain traffic.

It’s possible to have pages that are set up in ways that stop the plugin from working. You should test the plugin on one page before implementing it on your entire site.

To set up the autoLink plugin, you must add the plugin to your tag, define the domains you want to use, and tell each page to allow the plugin to run.

Related resources

analytics.js

gtag.js

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Google apps
Main menu
9288032173360394491
true
Search Help Center
true
true
true
true
true
69256
false
false