In this section, I will talk about how to do cross-site tracking in Google Analytics and send data from two websites to the same property.
Principle: Each site corresponds to a GTM container. Each site performs the same configuration in GTM, and sends data of different sites to the same GA-Property. The allowLinker and cookieDomain in the tag are to solve the identification problem of the same user at different sites. The problem of uniqueness of cross-site users is solved by passing the user’s uniquely labeled Client ID to another site during cross-site.
Here I have two websites that need to do cross-site tracking, http://www.bbccss.com and http://www.ichdata.com. We first create a new Property for cross-site tracking to collect data, the tracking ID is UA-69988360-24, now let’s go to GTM to do the configuration:
1、Create two constants
Create first constant to store the Tracking ID:
Create second constant to store the domain name of the site, which is a virtual top-level domain, separated by commas：
2、Set Google Analytics Settings
Create a Google Analytics Settings and do some configuration. This Google Analytics Settings is the basic setting for many tracking, such as page views and event tracking. The specific configuration is as follows:
allowLinker is to ensure the delivery of the Client ID, when the jump to another website will have an ID on the URL.
Auto Link Domains, this is a virtual primary domain that is shared by two websites.
Tracker Name is to ensure that data is sent to different properties. If your site sends data to multiple properties, be sure to set the Tracker Name.
In the final step, set the tag, this step is the same as configuring the base tracking code.：
On another website, do the same configuration as above.
4、Preview and Publish
Finally, let’s test it, click Preview in the upper right corner, and open http://www.bbccss.com：
Click on the link to jump to another website and notice the changes on the URL:
The Client ID is passed in and the two sites recognize the same visitor.
If there is no client ID on the URL of another site after clicking, then it is not recognized that he is the same visitor, that is, cross-site tracking is not successful. As long as the client ID is on the URL, the cross-site tracking is successful.