How to Accurately Measure the Same Visitor on Multiple Domain Names (cross-domain linking)?
Cross-domain tracking allows MVMCloud Analytics to record the same visitor on two related websites, for example, an e-commerce site and a separate shopping cart site as a single visit.
Why is it necessary to set up multiple domains for accurate cross-domain visitor tracking? o MVMCloud Analytics uses a visitor ID to record visit data. Visitor ID values are stored in cookies on the web domain of the visit. These cookies are first-party cookies and can only be accessed from the domain name specific domain in which they were created, therefore other domain names cannot access these cookies and the visitor ID. So when you need to track your visitors across different domains, the visitor ID must be forwarded from one domain to another using a special mechanism we call cross-domain linking, described in detail below.
To set up accurate cross-domain tracking, follow these steps:
-
Set up your domain names as alias URLs for your website MVMCloud Analytics - Enter MVMCloud Analytics and click Administration(gear icon at top right) > Sites > Manage. Edit your site and specify all your domain names in the Alias URLs field. There must be two or more domains for cross-domain to work.
-
Generate your JavaScript tracking code - In Administration > Sites > Tracking code, click on the “ Advanced: Show” and check the “Enable cross-domain linking” option (if this checkbox cannot be clicked, make sure you have defined at least two alias URLs for this site). This will also automatically mark the “In the 'External links' report, hide clicks on known alias URLs” box.
-
Check if the generated JavaScript tracker code is valid - In the Tracking code generated in MVMCloud Analytics you should see the following two lines:
_paq.push(["setDomains", ["*.domain1.com", "*.domain2.com"]]);
_paq.push(["enableCrossDomainLinking"]);
Please note that cross-domain linking will not work when cookies are disabled.
-
Paste this JavaScript tracker code to all your sites to be measured on all domains. In the example above, you need to add JavaScript tracker code to domain1.com and domain2.com. It is important to add the code to all your domains specified as alias URLs on your site MVMCloud Analytics.
-
Check if cross-domain linking is working correctly. Go to your domain1.com and click a link to your domain2.com. If cross-domain linking is enabled and working, the domain2.com URL contains a new parameter &pk_vid=. This pk_vid parameter will contain a data string that includes the visitor's ID. This way, the visitor ID current is forwarded to the different domain page. Similarly, when a user clicks from domain2.com for domain1.com, the domain1.com URL will also have this new parameter pk_vid.
You have successfully configured cross-domain linking: congratulations!
Advanced: Handling Dynamically Generated Links
The cross-domain detection feature works by adding the pk_vid query parameter to each link on the page when it loads. This is only done once, so if your web page or web application dynamically adds links to the page via JavaScript, they will not have this query parameter added to the URLs.
This doesn't mean that cross-domain detection for these links is impossible, but it does mean that you'll have to work a little harder.
First, in your link-generating JavaScript, get the pk_vid=... query parameter to use by calling the MVMCloud Analytics tracker's getCrossDomainLinkingUrlParameter method:
var crossDomainQueryParam;
_paq.push([ function() { crossDomainQueryParam = this.getCrossDomainLinkingUrlParameter(); }]);
Then make sure this value is appended to the link URL:
// NOTE: This example uses jquery, which you may not use on your website/webapp.
// How you add the parameter to the query will depend on how your link is generated.
var $linkToAdd = $('<a>my new link</a>').attr('href', 'http://my-other-domain.example.com/page.html?' + crossDomainQueryParam);
$('body').append($linkToAdd);
Grades:
- You can add the query parameter to the link at any time, as long as it is added before it is clicked/visited.
- You need to append the query parameter to all links in domain1.com going to domain2.com and to all links in domain2.com linking to domain1.com (See the list item above: “Verify that cross-domain linking is working correctly.”).
Cross-Domain Goal Funnel Conversion
By enabling cross-domain tracking using the instructions above, you will be able to track your conversion funnels and funnel steps across multiple domains.
Cross-Domain A/B Testing
When running a A/B test, you can only run it on one domain. It won't work to run an A/B test across multiple domains (because A/B test variations are stored in local storage or first-party cookies on the domain and are not shared across domains).
However, you can still use cross-domain tracking with A/B testing when, for example, running an A/B test in one of the domains, and in another domain, trigger goal conversions. The A/B test can use these goal conversions between domains into consideration when calculating A/B testing success metrics.
Multi-Domain Tracking and Roll-Ups
When you create a Roll-Up and aggregate multiple sites, you cannot use cross-domain tracking. The tracking Cross-domain only works on a site at MVMCloud Analytics (a site with multiple domain names).