Scripts run according to consent
The Scripts tab has three editors: Necessary scripts, Analytics scripts and Marketing scripts. A script inserted into a section runs on the website only when the visitor allows the relevant category.
When to use this tab
When you install the bar by inserting the script directly into the website and want to control all services from one place. The website code then stays clean and you make changes without a developer.
If you use Google Tag Manager, this page will warn you about it. In that case, handle conditional firing in GTM, not here. If you inserted the code in both places, it would run twice.
How to insert code
- Remove the service's code from the website template so it does not run twice.
- Insert it into the editor that matches its purpose. Analytics belongs in Analytics scripts, advertising and remarketing in Marketing scripts.
- If a service uses a separate library and a separate configuration, insert them as separate blocks in the order the provider recommends. The configuration code sometimes has to run only after the library has loaded.
- Save and test the website in a private window.
What goes where
| Section | Typical content |
|---|---|
| Necessary scripts | Scripts the website needs to operate, which always run. For example, the part of Sklik that has to send consent: 0 before consent is given. |
| Analytics scripts | GA4, Hotjar, Clarity and other tools for measuring visitor behaviour. |
| Marketing scripts | Google Ads, Meta, LinkedIn, Sklik, Heureka and other advertising and remarketing code. |
Sklik needs a specific procedure, because it has to run both before and after consent. You will find the full code in the Sklik and passing consent guide.
Google tags and Consent Mode
The bar runs scripts from Analytics scripts and Marketing scripts only after it has sent the consent update for Google Consent Mode. A Google tag inserted here therefore works with the current consent state as soon as it runs. Because it does not load at all until consent is given, it runs in the basic mode of Consent Mode.
Checking
- Open the website in a private window and do not give consent. No analytics or marketing scripts may run.
- Give consent and check that the scripts from the allowed categories have run.
- In DevTools, on the Application → Cookies and Network tabs, check that cookies and requests appear only after consent.