• Resolved Franz92

    (@franz92)


    Hello everone,
    thank you for your plugin. I am currently trying to integrate Complianz, Google Tag Manager and WooCommerce, following this guide and this document.

    Situation: To push eCommerce related events to Google Analytics we have to check first if consent is given for the “statistics” category in Compliance.

    Approach: To do that I am using a trigger, that fires upon the GTM4WP ecommerce events, but checks first wether consent has been given.

    I do this by using a custom Javascript function and a 1st-Party Cookie variable.

    This is the Javascript I am using:

    function() {
      var c = {{Complianz Cookie Value}};
    
      try {
        var consent_status = JSON.parse(c);
        if ( cmplz_has_consent(statistics) ) {
          return cmplz_has_consent(statistics).includes( "allow" );
        }
      } catch (err) {
        //something went wrong with JSON decode, perhaps cookie is empty or undefined
      }
    
      return undefined; // could be also false
    }

    Essentially, I am just trying to check wether consent has been given or not and store that value.

    And this is the shareable debug link – I’d expect the javascript (and the cookie) to return a value on the gtm4wp.addtocart events.

    I suspect that I am misinterpreting the developer guide you’ve posted above, but after an hour of trying to get it to work I may be running in circles. Can I ask you to help, please?

    Best,
    Franz

    • This topic was modified 2 years, 7 months ago by Franz92.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @franz92,

    Unfortunately, I don’t have an immediate answer, as I need to figure it out in relation to GTM4WP as well.

    But maybe this will work; https://complianz.io/using-exceptions-in-tag-manager-based-on-consent-status/

    Let me know, I will set up a sandbox to check myself as well,
    regards Aert

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @franz92,

    My first attempt.

    I used https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking-google-analytics-4-ga4-version to get some eCommerce events in Tag Manager,

    then proceeded to create an exception on the firing of these parameters based on the cookie status.

    I created a variable ‘1st party cookie’ with cookie name ‘cmplz_statistics’. Then added a custom event with this variable on ‘deny’ and added it as exception to the event tag named: “Statistics” is false.

    https://snipboard.io/xBNj8y.jpg. This seems to work. I have seen people use Trigger groups as well, including a statistics event trigger; cmplz_event_statistics as custom event.

    Let me know if I need to go in detail in somewhere. regards Aert

    Thread Starter Franz92

    (@franz92)

    Hi Aert,
    thank you so much, I implemented that. And yes, you are right: Trigger groups are very buggy, as they don’t carry over consent.

    A pointer for further readers.

    I created a variable ‘1st party cookie’ with cookie name ‘cmplz_statistics’. Then added a custom event with this variable on ‘deny’ and added it as exception to the event tag named: “Statistics” is false.

    He added a trigger based on a custom event: https://pasteboard.co/RTXIx02sj2eO.png (Hower, instead of “false” it must say “deny”.

    And this is the configuration of the variable: https://pasteboard.co/XpGuHOwUaxBs.png

    It mostly works. However, there are a few issues.

    1. Tracking happens before a selection (deny or allow) has been made by the user in the Complianz pop-up – when the user has not allowed or denied yet, the exception in the tags will not fire. Thus we have to wait until after the complianz event has been fired on the page, but the gtm4wp events are fired before.
    2. The blocking triggers fire only on the cmplz_event_statistics, but not on the Google Analytics eCommerce events. We’d actually need to get the value of the first party variable into the exception.

    I will ponder those two questions! ??

    That’s my debug link in case it helps.

    Thread Starter Franz92

    (@franz92)

    Ah, 1 was easy: We just use RegEx to match for either deny or undefinied.

    That way the exception only does not fire when the user allows tracking.

    Screenshot: https://pasteboard.co/2PUzAiT879qz.png

    But issue 2) persists… and I am at a loss on how to solve that. ??

    PS: I just understood that you did not create new triggers for “Statistics is false” above, but just added a filter to the existing triggers which trigger the eCommerce tags. Silly me. (But that doesn’t solve for 2).) : )

    Thread Starter Franz92

    (@franz92)

    Silly me: Issue 2 is solved by forcing users to allow, deny or customize their settings upon opening the page.

    Then everything works. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Complianz, Google Tag Manager and WooCommerce’ is closed to new replies.