August 25, 2023

How to use Serviceform Cookie Controller with Google Consent Mode

Google Consent mode with different cookie controllers can be quite tricky to set up. In this article we are going through how it works with Serviceform's Cookie Controller.
Time to read: 
2 min
Author:  
Iranthi Gomes
Google Consent mode with different cookie controllers can be quite tricky to set up. In this article we are going through how it works with Serviceform's Cookie Controller.

Google Consent mode with different cookie controllers can be quite tricky to set up. In this article we are going through how it works with Serviceform's Cookie Controller.

If you look at the website you are on currently, Serviceform.com - we're using this exact setup. You can see (unless our marketing team has got their hands dirty) that by default our website doesn't load any cookies.

How to use Serviceform Cookie Controller with Google Consent Mode: Website without cookies by default.
How to use Serviceform Cookie Controller with Google Consent Mode: Website without cookies by default


For hosting we're using Webflow - but this setup works on any type of website as long as the scripts are loaded in the correct order.

This guide is just one way of doing - and feel free to improve the ideas further.

  1. Create your Serviceform Cookie Controller

We wont be going deep into this, but you can find your embed code inside the platform. Follow the guide here to get your embed code.

  1. Script setup

Very important part on how to get this working is the order of the scripts and their execution. Google has a great article to explain how things work here. The following example is from Webflow, and the exact embed code we use for this site.

Script order:


1. Serviceform cookie controller script. This initialises Google Consent mode and gtag as required by Google.

2. (Optional) Serviceform loader script, for any other Serviceform tools, such as chatbots, forms or other.

3. Google Tag Manager script

4. (Optional) gtag.js script

5. Google Tag Manager footer script

Script order in Webflow, works in other tools too.
  1. Google Tag Manager setup

Google Analytics 4 will work out of the box without any extra work with the setup above.

However in most cases you want to add more scripts from third parties to the sites.

For that you need three more things.

1. Create the tag you want and add any scripts you want inside of this tag.

  1. In this tag you can add the Consents you want to require for this tag to fire. You can for example add statistics tag and marketing tags separately and link to them through here.
  1. Last thing you need is to add a Custom Event that listens to the event "cookieAccept" and linked this as a trigger, with another trigger "All pages"

After this setup is in place, your site will work perfectly with the Serviceform Cookie Controller.

Testa verktygen vi har skapat för din hemsida.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
"Inom sex månader kunde vi öka vår leadgenerering med 100+ leads varje månad. Det är väldigt enkelt och bekvämt, personerna är trevliga och du får svar snabbt när du behöver hjälp. Resultaten är bra, så prova dem.”
Olli Pohjonen
Huoneistokeskus