Tracking on page load
*This practice is not recommended as it is not in line with GDPR's requirement of prior consent.
In some cases, you might want to enable cookie tracking of one or more categories by default, and letting your users disable cookies tracking if they wish.
Implementing cookie tracking on page-load in the source code:
This practice is for allowing a script to run on page load and without consent from the user, but the user still has the option of disabling it, if they want to opt-out.
- follow this guide: Cookie Control SDK and Inline script, with the below additions/changes.
- replace the SDK code with the code you see below:
if (CookieInformation.getConsentGivenFor('cookie_cat_category') || typeof (CookieInformation.getConsentGivenFor('cookie_cat_category')) === 'undefined') { // here goes the script }
- replace the cookie_cat_category with the category you want to enable.
Implementing cookie tracking on page-load in GTM:
- follow this guide Cookie Control SDK and Google Tag Manager, with the below additions/changes.
- you have to add the GTM tag as a custom HTML tag and place the SDK around it.
if (CookieInformation.getConsentGivenFor('cookie_cat_category') || typeof (CookieInformation.getConsentGivenFor('cookie_cat_category')) === 'undefined') { // here goes the script }
- replace the cookie_cat_category with the category you want to enable.