In this example, we will set a cookie for a partner website that is looking for a cookie on the root domain to enable or disable their marketing scripts. We will use the real-life use case for websites that embed content from the watchmaker Rolex.
Some vendors or partners supply you with a code snippet whereby they can handle their own consent management, but they need input from Complianz. We will do the following for this purpose;
Create a category on the Cookie Banner for this specific partner, Rolex and its subsidiaries.
Based on this category, we will set a cookie named “rlx-consent” with values “true” or “false” based on consent for this specific partner.
Create an extra category on your banner
If you only want an extra category like “Social Media,” follow this article. This article will use the same basics but will add functionality to set a cookie.
We recommend using a Must-Use Plugin, which is a PHP file in the wp-content folder called “mu-plugins.” You can create the folder if it does not yet exist. If you know your way around PHP, you can go straight to our MU Plugin. https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/set-cookie-on-status-change.php
We will now explain what’s happening.
Adding the category
This filter will add the HTML and needed logic to have a custom category. You can adjust the text by changing the following strings:
“RLX label = Category Name e.g. Rolex
“RXL description = Category Description, e.g. This is a third-party supplier of content on this domain and uses statistics by Adobe to track usage and user behaviour.
Adding a custom cookie
The below code will add the custom cookie; you can, of course, edit the details, including the name and retention period. To check if everything works as suggested, we have added console.log() statements. You can remove these if unnecessary.
This integration is based on a separate category, which of courses includes categories by default. If you would like to set a cookie on an existing category, please use the below code without adding another category and change “cmplz-rlx” for the default categories like “cmplz-functional,” “cmplz-preferences” and so forth.