CF Forms as GDPR consent with site caching

Hi,

I am creating a GDPR consent block with CS Forms. I tried to add a cookie ‘SET’ action on form submission but it returned an error. Probably due to there being no data submitted upon clicking the submit button only. I added a hidden input field, which sets the cookie. Now I see the cookie added in the browser, and the error has disappeared. Is that the right way to do it?

Another problem is that when I open a page for the first time, the cookie notice appears as it should. But the cookie is SET in the background even though I don’t click the button in the consent block. As a result, the block disappears upon reloading the page. If I check the page with the dev tools and delete the cookie from Application, it happens again. There is no block on second reload

Maybe CF Form is not the best way to set a cookie. When the page reloads, it shows a message about sending the same form data again. However, with AJAX, this is probably not the case. If we use a regular Button Element, how do we make it SET a cookie only on click and not on page load?

What do I do wrong?

Hey @referee,

The cookie set DC runs on page load and not on form submission. The solutions for this requires custom development either by coding JS to set the cookie or by registering a custom form action. Both solutions requires a One service subscription so we can suggest a custom code solution.

Thanks @christian,

I will turn it off for now. But I hope that cookies consent functionality will be available as one of the features of CS Forms someday. At least it would be logical to have it inside that plugin.

Thank you for your feedback. I’ll list this as a feature request.