Create a third party cookie configuration JSON array to be included in the default cookie configuration JSON to display the third party cookies in the Cookie consent banner.
Code for adding the third party cookie configuration JSON to the default configuration JSON:
zc_cookies:[{
"group_id": "<category_identifier>",
"zs_name":"<service_name>",
"zs_desc":"<service_description>",
"zc_detail":[{
"c_name": "<cookie_name>",
"c_type" : "<cookie_type>",
"c_purpose" : "<cookie_purpose>",
"c_expiry" : "<cookie_expiry_duration>"
},
"group_id": "<category_identifier>",
"zs_name":"<service_name>",
"zs_desc":"<service_description>",
"zc_detail":[{
"c_name": "<cookie_name>",
"c_type" : "<cookie_type>",
"c_purpose" : "<cookie_purpose>",
"c_expiry" : "<cookie_expiry_duration>"
}]
}]
}window._zcBan.set_config(thirdparty_cookies);
Method to handle consent in Zoho Sites cookie bar
Event listeners should be added by the site owner to accept and decline events. These two event listeners are created in the document object and will be triggered for accept and decline respectively.
In the below sample code, two listeners are added to the document object.
When the user accepts cookies, the acceptConsent event is triggered with the categories accepted.
When the user declines cookies, the declineConsent event is triggered.
It is the responsibility of the site owner to handle the respective third party cookies based on the event listeners for accept and decline events.
Here is the script to handle consent in headers and footers:
document.addEventListener('acceptConsent', (e) => {
// Handle for accept event
});
document.addEventListener('declineConsent', (e) => {
// Handle for decline event
});