Developer forum

Forum » CMS - Standard features » Changing cookie consents

Changing cookie consents

Stephen Anthony Jackson
Stephen Anthony Jackson
Reply

Can someone tell me where to enable changing of cookie consents? I am looking for an item type for a cookie manager, but all I find is a cookie notice type which lists out whats allowed.

When accessing site for first time, you get a modal and banner, and the banner template is what I want to use for another page which will allow one to alter consents later, but what is the item type this template should be used with?

I have looked on documentation pages, but that just coveres what the various cookie types in the cookie manager are. There is no swift documentation about this it seems

Cheers

Steve


Replies

 
Alexey Tanchenko Dynamicweb Employee
Alexey Tanchenko
Reply

There are some points of how to control the cookies.

We have a tool to manage the cookies: Settings > Web & HTTP > Cooke Manager.
- In "Settings" you may configure some base settings. There you may set your own template. The templite file should be placed in the "Files/Templates/CookieWarning" folder.
- In "Categories" you may manage the available categories. And then assign some cookies to the categories. If you use the built-in "Cookies.cshtml" Swift template, it automatically list all the Categories - renders them as togglers in the modal.

Once a user selected some Categories in the modal and save it, the "Dynamicweb.CookieOptInLevel" cookie will be created. While this cookie is exist and not expired, you cannot open that modal again. 

To remove the cookie you can: 
1. Execute the "Dynamicweb.Environment.CookieManager.ExpireCookie("Dynamicweb.CookieOptInLevel");" code in any .cshtml template.
2. POST a form with needed parameters - the example of the form is placed in the built-in "Cookies.cshtml" Swift template. Search for "dwCookieModalCustomForm" in the file. 
To remove the cookie you need to have a form with the same "method" and "action" and 2 hiddens it has. Just set the "OptInLevel" hidden value to "0".
The page reload is need in both cases to take effect.

The Item Type where you can configure the cookies modal is "Master" - it uses in Website settings. But it only affect how the built-in "Cookies.cshtml" renders.
For any manipulations with the cookies themselves, you can use the "Dynamicweb.Environment.CookieManager".

There are 2 related threads where you may find some additional info:
https://doc.dynamicweb.com/forum/templates/templates/cookie-manager
https://doc.dynamicweb.com/forum/swift/swift/enable-and-use-consent-mode-gtm-through-dw-cookie-manager

 

You must be logged in to post in the forum