• Resolved matthias.wagner

    (@matthiaswagner)


    hello!

    we have already found a lot of information on how to set up complianz and google tag manager correctly.

    i would like to hear your opinion on a scenario we would like to achieve:

    • we want to use google tag manager for GA4 as well as marketing-pixels like linkedin insight tag
    • i already know that we can use the complianz events like cmplz_event_statistics or cmplz_event_marketing to fire these tags in tag manager
    • i would also like that (empty) tag manager is only loaded after opt-in. i found a tutorial for this (https://complianz.io/how-to-set-google-tag-manager-after-consent-and-is-it-needed/), but this tutorial will only load the tag manager after statistics opt-in.
    • we would need a script or a solution that includes tag manager if only one of these categories has been selected for opt-in, as well as for multiple categories.

    i think of something like this javascript:

    if(cmplz_has_consent('statistics')||cmplz_has_consent('marketing')){
    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXX');
    }

    what i do not like with this solution is:

    • this script would need to be included somewhere in the theme. i don’t know where it would be possible to integrate in complianz, since the script center would again be limited to the selection of one category
    • the categories would be hardcoded

    i think the best solution would be if you could change the behaviour in script center, so that there is no radio button for the selection of the category when adding scripts, but checkboxes, so that the script is added whenever one of these catogories has been accepted. it could become even more interesting if you add a “and/or” switch, so that one could also limit a script to the opt-in for two ore more categories.

    i hope you understand my idea and can point me to a good solution. if you like the idea for the script center as well, it would be great to see this in future releases ??

    thanks
    matt

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @matthiaswagner,

    Firing the same exact script on two separate consent categories is not supported. Which is why we propose firing Tag Manager itself, then firing the tags in the GTM container which require consent by using the available consent triggers.

    But let’s say that this would be possible: what behavior would you expect to occur when the visitor revokes their consent to Marketing, but not the Statistics category? Should the script that is fired on both categories still be loaded, or revoked?

    A possible alternative might be using separate GTM containers for your Statistics and Marketing tags, so that you can fire the desired script/container on consent to those categories.

    Kind regards, Jarno

    Thread Starter matthias.wagner

    (@matthiaswagner)

    hy,

    thank you for your quick reply.
    i want to avoid firing tag manager itself before any consent, since it would be useless and we never know which data google collects also with an empty tag manager ??

    regarding your question what should happen on revoke: this would need to be dependent on the setting if it should be “and” or “or” for the multiple categories.

    i do absolutely understand if this is too far away from your current solution to think of including it in complianz.
    thank you for your idea of using two containers.

    i will try the code-idea i shared and give feedback, in case anyone else is also interested.

    matt

    Thread Starter matthias.wagner

    (@matthiaswagner)

    hello!

    just in case others are interested in this too. we just had to rethink the setup ??
    we now use script center to manually include the code from tag manager and set up two third-party-scripts for tag manager. one is triggered by statistics opt-in, one is triggered by marketing opt-in.

    of course we do not want the code to be loaded twice, so each piece of code is wrapped by

    if(!window.dataLayer.find(element => element['gtm.start'])){ ... }

    thanks to https://stackoverflow.com/questions/55852511/how-to-check-if-a-google-tag-is-already-loaded-on-an-html-page

    this is a good and flexible setup.

    matt

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Google Tag Manager to be used for statistics AND marketing stuff’ is closed to new replies.