Closed Oynowan closed 8 months ago
Hi, currently it is not possible to set cookies table from the GTM template. But it is possible to use CMP integration if you expose a simple JSON API somewhere on your site.
The endpoint should look like this:
your-domain.com/api/v1/cookies/{projectCode}
For example
your-domain.com/api/v1/cookies/my-project
The endpoint will receive query parameter locale
with the current cookie bar locale code.
The response should be as follows:
{
"status": "success",
"data": {
"cookies": [
{
"name": "Cookie1",
"purpose": "Cookie1 description",
"processingTime": "30 days",
"cookieProvider": {
"code": "google",
"name": "Google",
"type": "3rd_party", // 1st_party or 3rd_party
"link": "https:\/\/policies.google.com\/privacy"
},
"category": {
"name": "Ad cookies",
"code": "ad_storage"
}
},
{
"name": "Cookie2",
"purpose": "Cookie2 description",
"processingTime": "1 hour",
"cookieProvider": {
"code": "google",
"name": "Google",
"type": "3rd_party",
"link": "https:\/\/policies.google.com\/privacy"
},
"category": {
"name": "Ad cookies",
"code": "ad_storage"
}
}
]
}
}
Then you can configure the integration as described in the documentation.
Check the option Cookies API enabled
and keep the option Consent API enabled
unchecked.
Thats amazing, sounds super simple. Will try it tomorrow. Could you just tell me what is a "projectCode"? I don't understand it totaly.
Edit.
Understand it already.
I implemented it and works perfectly! One last question, what exactly is Consent API? I understand it that google is sending me a consent for each user, but i am just not sure why. Maybe because i don't realy understand all concept of CMP.
The Consent API is used to collect user consents if you need to store them. As can be seen in the source code, the cookie bar will send new/changed consents automatically using the PUT method when the user clicks the bar on the endpoint your-domin.com/api/v1/consent/{projectCode}/{userUdentity}
.
I see. I don't think i will need it, but it's good to know if needed.
Thank you for your answers.
How could i add cookie tables in gtm if i have no CMP? Can i do it manually?
There is no discussion tab, thats why i had to open it as a issues. If there is better place to contact this kind of questions please let me know and close the issue.
Thanks