Skip to main content

Cookie banner Callbacks and Endpoints - AdOpt

callbacks endpoints webhook JavaScript events functions requests triggering integration API

Written by AdOpt Support

AdOpt's cookie banner gives users a quick and easy way to manage their consent and inform themselves of the purpose for which the data is being used.

However, it is often necessary for your website or webapp to be notified of this consent. Either to block the collection of some data or to change the information displayed on the screen.

Through javascript callbacks the AdOpt Banner can notify your website or webapp of a new consent setting.


The callback is created by overriding the function:

<script>
window.adoptCB = function (consent) {
console.log('callback do adopt:', consent);
};
</script>

The format of the callback argument follows the format:

{
visitorId: "Visitor ID",
disclaimerId: "Disclaimer ID",
websiteId: "Disclaimer Website ID",
tags: [
// Array with information from all Tags
],
language: "Language displayed in the Cookie Banner",
legislation: "Displayed Legislation"
}

Reply example:

{
cookieId: "123abc",
optInTags: ["456def", "789ghi"],
optOutTags: ["012jkl", "345mno"]
}

Website data endpoint

Now with the IDs of the tags that the visitor gave (or denied) consent to, you can query an endpoint with your website data and relate the IDs to the tag names.

https://disclaimer-api.goadopt.io/api/tag/disclaimer-info/<website_code>

The website_code here is the same as the one used in the tag you placed on the website.

This call must have a callback in the format:

{
disclaimer: {/* disclaimer's visual configuration */},
terms: { /* Terms of Use URL */ },
policy: { /* Privacy Policy URL */ },
tags: [
{ id:"6332f834-41df-4cc5-a3bf-dffe359112c5", name:"Adopt", tag_category_id:2 },
/* Tag Objects Array */
]
}

Reply example

{
disclaimer: {
colors: {
primaryColor: "#4BBAD7",
secondaryColor: "#0a1f33",
bgColor: "#000",
textColor: "#fafbfc",
position: "left",
buttonPosition:"left"
}
},
terms: {
url:"https://goadopt.io/terms"
},
policy: {
url: "https://goadopt.io/terms"
},
tags: [
{
id: "6332f834-4a0f-4cc5-a3bf-dffe345112c5",
name: "Yahoo",
tag_category_id: 2
},
{
id:"43d4ece5-fa7c-4369-ab23-a2393f745es3",
name: "Cloudflare",
tag_category_id: 4
},
{
id: "a4409b60-80ca-4bf8-af0d-f6cc124502b3",
name:"Hariken",
tag_category_id: 1
},
{
id: "z81efe08-c88b-40db-b39d-0a580945ebc6",
name:"Facebook",
tag_category_id: 2
},
{
id: "fg0ff14a-cdd8-42e1-aba3-3df22145c27c",
name: "Google Tag Manager",
tag_category_id: 5
}
]
}
Did this answer your question?