Cookies and Cross-Domain Testing

 

Important

Convert uses only first-party cookies, even for cross-domain setups. This means that browser updates blocking third-party cookies, such as those in Safari, Firefox, and Brave, do not affect Convert's tracking functionality. Therefore, all visitors, regardless of the browser they are using, remain trackable across domains where first-party cookies are supported.

Introduction

This article describes how Convert Experiments handles cross-domain testing; e.g. if your website spans multiple domain names - this is often the case if you are using a third-party shopping cart. 

First Party Cookies

Before we get into the details, it’s important to understand the fundamentals of how Convert tracks visitors. Convert uses first-party cookies to identify your site visitors. First party cookies are set with the same domain name that is in the location bar of the visitor’s browser. It is very important to understand that cookies can only be 'seen', and changed, by the domain that sets them. In fact, it is almost impossible for a website to set a cookie for a different website. This is due to the default security setting that most browsers have. Website A can not set a cookie on website B.

Third Party Cookies

Let’s take this knowledge and apply it to how Convert works. When a user lands on a page on your site, the Convert Tracking Code looks for the Convert Tracking Cookies. If it finds the cookies then it updates them. If it does not find the cookies it sets them. Remember, if your website domain is www.convert.com, then the tracking code can recognize cookies with the www.convert.com domain and it can set cookies for the www.convert.com domain.

As the user continues their session the tracking code interacts with the tracking cookies. Continuing with our example, the user on our site is just about to click on a link to different domain, the third party e-commerce platform we use. They will leave our domain and go to the e-commerce provider’s domain. We’ve been tracking this user with a specific set of cookies on our domain. When the visitor leaves our domain we want them to take their cookies with them. The cookies identify them as a unique visitor, and if they don’t take their cookies to the next domain then we will lose the rest of their session information and that’s not good.

 

 

Tip

Third party cookies were disabled in Convert Experiences on February 21st, 2018; therefore you can use the methods described below.

 
 

 

Transfer Cookies to a Third Domain via Active Websites

In Convert Experiments we organize Experiments into Projects. A Project is an entity that can contain any number of Experiments and which includes domains (Active Websites) which are part of the Project:



Tip

All the websites within one Convert Project share the cookies making it possible to achieve cross-domain testing, UNLESS you enable the Project Setting "Do not allow cross-domain linking". 

 

The way cookies are shared between domains is done by automatically passing cookies between domains that belong to the same project when a visitor clicks on links or submits forms. Those cookies get passed to your other domains through GET variables. Two variables are added to the query string in order to pass cookies:

  • _conv_v
  • _conv_s

 

Do not allow Cross Domain Linking

Some systems do not allow extra query variables. If that is the case, you can deactivate automatic cookie passing inside your Project Configuration:

 

Pass Cookies Manually

It’s also possible to manually pass cookies to selected links or forms. All you need to do is to pass the _conv_v and _conv_s variables in the URL of the link or action of the form. Here is an example:

<a href="http://www.myothersite.com/page.html" onclick="window.location=this.href+'?_conv_v='+escape(convert.getCookie("_conv_v"))+'&_conv_s='+escape(convert.getCookie("_conv_s")); return false;" >

You can also add the parameters to all links manually with the following code that you add to your Convert > Project > Global Javascript section. Just change the 2nddomain.com for the domain where the cookies need to be transferred.

document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("a[href*='2nddomain.com']").forEach(function(link) {
var url = new URL(link.href, location.href);

// Check if the query parameters already exist, and only append if they don't
if (!url.searchParams.has("_conv_s")) {
url.searchParams.append("_conv_s", convert.getCookie("_conv_s"));
}
if (!url.searchParams.has("_conv_v")) {
url.searchParams.append("_conv_v", convert.getCookie("_conv_v"));
}

link.href = url.toString();
});
});

 

GDPR Warning Message

The cross domain cookie will be by default turned off for all projects in Convert Experiences due to GDPR. Activating this will create a warning message as shown here.