Learn business growth with Google Analytics 4 Forums Google Analytics 4 Enhancing Consent Mode in Google Analytics 4: Updating Status and Triggering Tags

  • Enhancing Consent Mode in Google Analytics 4: Updating Status and Triggering Tags

    Posted by Elijah on 1 February 2023 at 3:59 am

    Hey folks, I’m in need of some advice or a solution around GA4 Consent Mode.

    So here’s the thing: a couple of CMS systems have rolled out their own Consent Plugins. Yet, like with everything, there’s the good and the bad. These plugins do a solid job of blocking cookies and scripts – until they get that all important permission from the user. Once the green light is given, I’ve been attempting to update tags using this tasty piece of JS code:

    
    <script>
       gtag('consent', 
       'update', {
          'ad_storage': 'granted',
          'analytics_storage': 'granted'
       });
    </script>
    
    

    Unfortunately, it’s not always as smooth as butter, and this approach has hit some bumps in the road – it seems like consent isn’t always being updated properly. But the real brain-teaser happens with non-Google Tags.

    The culprit? The Facebook tag. Despite setting the rule for “Require additional consent for tag to fire to ad_storage“, once the storage status is updated in the Consent layer, the FB tag isn’t firing as it should. It gives me the impression that the updating process should be happening earlier…

    So, if any of you have some nuggets of wisdom, an alternative JS solution, or any thoughts at all – toss them my way, I’d really appreciate it. Check the attached image for a clearer picture of what’s going on.
    enter image description here

    Elijah replied 12 months ago 3 Members · 2 Replies
  • 2 Replies
  • Isabella

    Member
    21 June 2023 at 3:28 am

    The problem here seems to be with trying to manage cookies and other scripts that come from various tags, specifically non-Google ones like Facebook. Updating the tags to ‘granted’ should allow the cookies and scripts to function as normal once the user gives their consent. But this isn’t always the case, with the Facebook tag still not firing even when it’s set to be granted additional consent. The current process isn’t working as smoothly as expected, so some new insight or solutions would be very helpful. The goal is to make these tags update correctly on both Google and non-Google tags when user consent is given, thereby allowing cookies and scripts to work as they should.

  • Elijah

    Member
    29 June 2023 at 5:08 pm

    It seems like you’re having trouble with the timing of the Facebook tag firing after users grant consent via your Consent Plugin. Unfortunately, I don’t have a direct fix, but it might be worth checking out the official documentation or Facebook developers community for possible solutions or workarounds for this timing issue.

Log in to reply.