How to store consents

Storing consent records is mandatory under GDPR for some countries. While most websites don't need this level of GDPR compliance, Finsweet Components gives you the option to implement consent storage by sending consents to database.

Follow this step-by-step guide to store consents:

1

Create a Cloudflare account or log in to an existing one

Go to cloudflare.com to access your account or create a new one.

2

Create a new 'Worker'

Go to 'Workers & Pages' > 'Overview' > 'Create Worker'.

Name your worker and confirm.

3

Edit the code

Click on 'Edit code'.

Remove the placeholder code.

Insert the code below:

https://cdn.jsdelivr.net/gh/finsweet/cookie-consent-worker@1/worker/script.js

Click on 'Deploy' and Confirm.

4

Create a 'KV'

Go to 'Workers & Pages' > 'KV' > 'Create a namespace'.

Name your namespace and click on 'Add'.

5

Bind the 'Worker' with the 'KV'

Go to 'Workers & Pages''Overview' and select the worker you created.

Go to 'Settings' > 'Variables' and click on 'Add binding'.

Add variable name 'CONSENTS', connect your KV spacename and click on 'Deploy'.

The variable 'CONSENTS' is case-sensitive. Make sure to use the variable name exactly as 'CONSENTS' in uppercase. Other variations, such as 'Consents' or 'consents', will not work.

6

Add the endpoint

Right click on 'Visit' link and click on 'Copy Link Address' to get the endpoint URL.

Paste the endpoint URL in the Cookie Consent Component in the configure tab and click on 'Update Component'.

7

Publish your project! Done!