Cookie controller

8min

What is it?

The Serviceform Cookie Controller is built to help you manage your website cookies, third party scripts and their consent.

It automatically adds on your website a cookie consent popup that forces the customer to make a choice.

serviceform cookie controller
serviceform cookie controller


How does it work?

The solution is cookie based and utilises a cookie called “cookie_consent_preferences”. This cookie is then set as customer sets to any of the following values.

Allowing all cookies - "all" Not allowing any cookies - "necessary" Allowing specific cookies - value will be a string separated by "|": "marketing" "preferences" "statistics" "necessary" Example value of "cookie_consent_preference" cookie: "marketing|preferences|necessary"

For example the value will be “marketing|preferences|necessary” if you choose marketing and preferences, but deny statistics.

Google Datalayer will be sent the same values in the following way:

// Example event. window.dataLayer.push({ 'event': 'cookieAccept', 'cookieAccepted': 'yes', 'cookieAcceptLevel': "marketing|preferences|necessary" });

This allows you to load specific third party scripts using Google Tag Manager based on your users cookie or selection preferences.

Getting started

To add the cookie controller on your website, all you need to do is to: 1. Log in to Serviceform 2. Add your domain 3. Add either the partner script or the individual cookie script to the of your website.

You can find your own cookie embed settings under Cookie Controller -> Embed.

Document image




The tool automatically adds a way for the customer to change their cookie preferences with a button at the bottom, or as a floating element in the bottom left corner.

You can also add a class “js-footer-edit-cookies” which can be used to trigger the modal.

Logs and statistics

The serviceform cookie controller gathers anynomised statistics of usage, mainly the three types of consent. Allow all, deny all vs modify, so you will know how many users use the tools and what they choose. On top of this the tool logs each consent request and marks an computer ID, timestamp and consent type as required by the legislation.

serviceform cookie statistics
serviceform cookie statistics


Automatic script and cookie blocking

The cookie tool can be set to automatically block third party scripts. This is done with setting a script value before the embed script. Make sure your cookie controller embed code loads before your third party scripts. This means it should be set as "high" as possible in the DOM for it to block the third party scripts.

window.sf_cookies_block = { type: "block", whitelist: "domain1.com, domain2.com", blacklist: "domain3.com, domain4.com" }

By leaving blacklist empty, it will block all third party URLs from loading.

Automatic translations

The Serviceform Cookie Controller automatically translates to the users language based on the HTML lang tags.

Document image


We currently support the following languages with automatic translation: - English - Finnish - Spanish - Swedish - Estonian - Latvian - Lithuanian - Russian - German - Czech - French For example if your language is English, and you change to German, we detect the change in the lang tag to "de" and the cookie controller language changes. It will also retain the cookie selection as long as you keep the same main domain.

More information on cookies

Cookies are pieces of information stored on your browser to identify you as a user. There are alternative possibilities such as localstorage that can work in similar ways. To find more information on GDPR and it's relation to cookies: