Ensure long-lived consent consent storage via the Consent Studio CMP HTTP Consent Cookies feature
Consent Studio sets cookies to store a cached version of a user's consent state and their Consent ID.
How to configure HTTP Consent Cookies in Cloudflare
Prerequisites
We will work with a Cloudflare Worker. This requires the following conditions to be met beforehand.
You must have Cloudflare set-up as the nameserver for your domain
You must have proxy mode enabled in Cloudflare for the domain that corresponds with your Consent Studio property ("site")
1. Register the Cloudflare Worker
1. Open the Cloudflare dashboard by going to https://dash.cloudflare.com.
2. Make sure that you are within the target workspace
3. Navigate to Workers & Pages in the Compute (Workers) section of the navigation panel on the left hand side.
4. Select the Hello World template.
5. You will now get a success notification. Click the Edit code button in the top right corner.
6. In the code tab for the worker.js file, paste the code from our Cloudflare Worker repository on Github: https://github.com/vallonic/consent-studio-cloudflare-worker.
7. Press Deploy in the top right corner. Your worker is now available to connect to a domain/route.
2. Connect a route to the worker
1. Go to Account home to see all your domains within your workspace. Select the domain that you want to install the worker on.
2. Within the context of a domain, click Workers Routes in the navigation column on the left.
3. Click Add route in the HTTP Routes section.
4. In the modal, use the following pattern for the route value:
[your domain here]/consent-studio/ssc*
Examples:
consent.studio/consent-studio/ssc*
vallonic.com/consent-studio/ssc*
5. In the modal, select the Worker that you have registered as part of "1. Register the Cloudflare Worker".
6. In the modal, click Save
3. Instruct Consent Studio to use the CDN Worker
1. Open the General Settings panel in the Consent Studio dashboard.
2. Open the HTTP Consent Cookies tab. You may need to horizontally scroll in the tabs list.
3. Make sure that the Enable HTTP Consent Cookies toggle is enabled.
4. Make sure that the Enable HTTP Consent Cookies via a CDN Worker is enabled.
5. Press Save Changes to make the changes definitive.
When Enable HTTP Consent Cookies and Enable HTTP Consent Cookies via a CDN Worker are enabled, but the worker is improperly set-up, you will risk that your consent log will not register newly provided consent and HTTP consent cookies are not set. It is important that you test your configuration right away.