Skip to main content
All CollectionsFAQ ❓️❓️Consent
How to store consent between two different domains ?

How to store consent between two different domains ?

M
Written by Manon Manso
Updated over a week ago

Want to keep the consent from one domain to another? Here's how to do it!

Once the user has made his choice, his consent is stored in our database with an anonymous identifier named "Token".

You can pass the consent between two domains by passing this Token in a Query String parameter axeptio_token.

For example, if I'm on my site site.com and I want to pass the consent on my domain mywebsite.com, I will have to pass the token in the link to mywebsite.com :

<ahref="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 several links pointing to your second site, you can pass the token automatically to the different links upon 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;
}
}
});
});});

Therefore, all links pointing to mywebsite.com will have the token added to them to retrieve the user's consent.

Our SDK will take care of the rest 😉

Did this answer your question?