Improve dataLayer events

Created on 2 May 2023, about 1 year ago
Updated 9 May 2023, about 1 year ago

Problem/Motivation

Currently the module pushes a data to the dataLayer whenever the cookie preferences change (when you click "save" in the cookie module or when you click "only accept necessary cookies") AND whenever a new page is loaded. (see attached screenshot 1 for what is currently pushed)

This concept is great, but the way things are pushed to the dataLayer need to be updated because due to the current technical setup we can't use that dataLayer information in GTM.

Proposed resolution

What we need: a separate "event" needs to be pushed to the dataLayer for EACH category that is ACCEPTED + a general "cookie_consent_update" events needs to be pushed to the dataLayer on each pageview and each time preferences are saved/changed. This is also how external solutions like "cookiebot" work (see a live demo of this on showtex.com).

Example:

  • You go to one of our websites and the default cookie banner shows up, showing 4 categories: necessary, functional, analytics and marketing.
  • You click on "accept all"
  • At that time: 5 separate dataLayer events are pushed to the dataLayer
    • event:cookie_consent_update
    • event:cookie_consent_necessary
    • event:cookie_consent_functional
    • event:cookie_consent_analytics
    • event:cookie_consent_marketing
  • On each consecutive pageview those same events will fire
  • When you change your preferences to for example only allow necessary cookies only two event will fire:
    • event:cookie_consent_update
    • event:cookie_consent_necessary

Remaining tasks

create MR with changes to the JS hooks

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇴Romania reszli Târgu Mureș

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024