Uploaded image for project: 'Planet4'
  1. Planet4
  2. PLANET-6697

Consent Mode: Fire default consent before gtm starts


    • Icon: Bug Bug
    • Resolution: Merged
    • Icon: Must have Must have
    • 2.79.1
    • None

      Cf. comment on PLANET-6625

      “Take a note that Page View event fires on the gtm.js event which fires before the consent event. That's why the first collect? hit doesn't have gcs a parameter and  gid is the same on any page. Let's try to fire event with consent before gtm.js - it should help”

      Can we send the ‘consent’ arguments before the GTM script is loaded? That should fix our last issue. 

      Fire consent mode before gtm.start

      GTM starts in templates/blocks/google_tag_manager.twig, included at the top of html_header.twig

      Consent mode is fired later, included in the bottom of the page, and requires the window.p4bk_vars also declared at the bottom of the page.

      This ticket probably requires us to declare window.p4bk_vars at the top of the page.
      We could also declare gtag functions at the top and use them in cookies.js, so that we don't duplicate functions.

            fhernand Florent Hernandez
            fhernand Florent Hernandez
            Maud Leray Maud Leray
            0 Vote for this issue
            2 Start watching this issue