Standard cross-domain pageview tag

Tag configuration

The most obvious reason to fire a pageview tag is that somebody loaded a page on the site. You may also wish to fire one on a single-page application that treats different components as different pages (for example, a React application that uses React Router to creating the experience of navigating different pages). For now, let's just cover the basics of the pageview tag itself.

For "Tag Type," choose the Google Analytics: Universal Analytics

Google Analytics Settings

Click "Enable overriding settings in this tag." This will reveal a new field, and you'll be able to pick the {{GA Property X-domain}} variable that you set up previously.

Next, we'll associate some metadata with this tag so that we can see more than just the number of page views in Google Analytics.

Custom fields

Assign the following keys and values:

  • allowLinker: true

  • cookieName: _ga

  • customTask: {{Client ID X-Domain}}

  • hitCallback: {{Remove X-Domain cookie from URL bar}}

We describe how to set up the {{Client ID X-Domain}} and {{Remove X-Domain cookie from URL bar}} above.

Custom dimensions

You should also add at least 2 custom dimensions.

If you have other data you wish to associate with each page view, you may wish to add additional variables and assign them here. For example, on, we include the content type of each page with each page view tag.


Finally, for "Triggering," choose the "All pages" built-in page view trigger.

Important for single page applications: If you change pages "virtually," e.g. by loading a new component when a URL changes in React, you will not be able to use the regular page view tag. You will have to fire "virtual" pageviews instead.

You can do this using the "history change" trigger instead of the "All pages" trigger. However, here is an important note to keep in mind about collecting page view data this way: Google Tag Manager "freezes" the current state when an event is triggered, which means that any metadata you want to collect will be from the current page, and not from the page the visitor is loading.

For example: A visitor clicks from page A to page B. You want to collect metadata about page B -- maybe a product ID number or some other item hidden in Google Tag Manager's dataLayer object. When the user clicks on page A, the current dataLayer will be frozen. The tag will collect whatever metadata is in page A's dataLayer, not in page B's. Here is a blog post that better explains this issue, as well as how to circumvent it.

Last updated