Want to keep consent from one domain to another? Here's how to do it!
Once the user has made their choice, their consent is recorded in our database with an anonymous identifier called "Token".
You can transfer consent between two domains by passing this Token in a axeptio_token Query String parameter.
For example, if I'm on my site monsite.com and I want to pass the consent to my domain mywebsite.com, I will need to pass the token in the link redirecting to mywebsite.com:
<a href="https://www.mywebsite.com?axeptio_token=42321jg21fs29dn6cv7">
🚧 Both domains must use the same Axeptio project and the same widget configuration, as consents are linked to a configuration.
If you have multiple links redirecting to your second site, you can automatically pass the token to the different links upon user consent.
Here is an example code:
window._axcb = window._axcb || [];
window._axcb.push(function (a) {
a.on("cookies:complete", function (c) {
c = document.querySelectorAll("a");
c.forEach(function (b) {
var d = b.getAttribute("href");
if (d && d.startsWith("http")) {
var g = new URL(d);
var e = window.location.hostname
if (e !== g.hostname && d.match(/mywebsite.com/)) {
g.searchParams.set("axeptio_token", a.getToken());
b.href = g.href;
}
}
});
});});
This way, all links redirecting to mywebsite.com will have the token added, allowing you to retrieve the user's consent.
Our SDK will take care of the rest 😉
