You can share a visitor's consent between two different domains by passing the Axeptio token via a URL parameter. When a visitor gives consent, Axeptio generates an anonymous identifier (Token) stored in its database.
Prerequisites
Both domains must use the same Axeptio project and the same widget configuration.
Method: pass the token via a URL parameter
Add the axeptio_token parameter to the redirect URL to the second domain:
<a href="https://www.mysite2.com?axeptio_token=42321jg21fs29dn6cv7">Go to mysite2.com</a>
Automate token passing on all links
If your site contains multiple links to the second domain, use this script to automatically add the token to each relevant link:
window._axcb = window._axcb || [];
window._axcb.push(function (sdk) {
sdk.on("cookies:complete", function () {
var links = document.querySelectorAll("a");
links.forEach(function (link) {
var href = link.getAttribute("href");
if (href && href.startsWith("http")) {
var url = new URL(href);
if (url.hostname !== window.location.hostname && href.match(/mysite2\.com/)) {
url.searchParams.set("axeptio_token", sdk.getToken());
link.href = url.href;
}
}
});
});
});
Replace mysite2\.com with your target domain. The Axeptio SDK handles retrieving the consent on the receiving end.
Looking to share consent between a main domain and its subdomains instead? See How to share consent between a domain and its subdomains.
]]>
