[{"data":1,"prerenderedAt":95},["ShallowReactive",2],{"storyblok:blog\u002Fconsent-mode-in-gtm:version=published&resolve_relations=blog-entry.categories":3},{"stories":4,"story":5},[5],{"name":6,"created_at":7,"published_at":8,"updated_at":9,"id":10,"uuid":11,"content":12,"slug":85,"full_slug":86,"sort_by_date":38,"position":87,"tag_list":88,"is_startpage":89,"parent_id":90,"meta_data":38,"group_id":91,"first_published_at":92,"release_id":38,"lang":93,"path":38,"alternates":94,"default_full_slug":38,"translated_slugs":38},"Consent Mode in GTM","2022-06-20T17:45:15.819Z","2022-07-08T19:39:23.512Z","2022-07-08T19:39:23.534Z",152916336,"5cb5cde4-932a-4571-9f3d-05887c631f2a",{"_uid":13,"date":14,"content":15,"component":82,"categories":83},"bc36c9ac-69eb-4e0d-a115-b32ceec34969","2022-05-17 17:54:13",[16],{"_uid":17,"text":18,"component":26},"86393a0a-bbd2-43c7-a320-25cd27211626",{"type":19,"content":20},"doc",[21,27,42,61,65,70,74],{"type":22,"content":23},"paragraph",[24],{"text":25,"type":26},"At work, I was tasked with creating a new cookie consent popup and a system to connect it to all of our external tags and scripts. Not long ago Google added a new Consent Mode in GTM that is now fairly stable and ready to be used.","text",{"type":22,"content":28},[29,31,40],{"text":30,"type":26},"To use this new system you need to ",{"text":32,"type":26,"marks":33},"activate",[34],{"type":35,"attrs":36},"link",{"href":37,"uuid":38,"anchor":38,"target":38,"linktype":39},"https:\u002F\u002Fsupport.google.com\u002Ftagmanager\u002Fanswer\u002F10718549?hl=en#:~:text=The%20Consent%20Overview%20page%20provides,Settings%2C%20select%20Enable%20consent%20overview.",null,"url",{"text":41,"type":26}," it in your container settings in GTM. After doing this you will have a few new tools to limit what tags fire based on what consent modes the user allows.",{"type":22,"content":43},[44,46,52,54,56],{"text":45,"type":26},"There are a few existing templates for Consent Mode, but the majority of them are for specific Cookie providers. The best template for a general implemenation I found was the one ",{"text":47,"type":26,"marks":48},"Simo Ahava has created",[49],{"type":35,"attrs":50},{"href":51,"uuid":38,"anchor":38,"target":38,"linktype":39},"https:\u002F\u002Fwww.simoahava.com\u002Fcustom-templates\u002Fconsent-mode\u002F",{"text":53,"type":26},", but this is where I encountered some issues. The tags were not firing in the right order.",{"type":55},"hard_break",{"type":57,"attrs":58},"image",{"alt":59,"src":60,"title":59,"copyright":59},"","https:\u002F\u002Fa.storyblok.com\u002Ff\u002F151486\u002F700x716\u002F5245fecdfa\u002Fblobid0.png",{"type":22,"content":62},[63],{"text":64,"type":26},"After a conversation with Google, we have been able to figure out that the issue was that I was using \"url_passthrough\" on the tags that set the consent. Setting this kind of parameters can cause a delay in the firing process, which it clearly did for us.",{"type":22,"content":66},[67],{"type":57,"attrs":68},{"alt":59,"src":69,"title":59,"copyright":59},"https:\u002F\u002Fa.storyblok.com\u002Ff\u002F151486\u002F1391x988\u002F7e22b934e7\u002Fmceclip0.png",{"type":22,"content":71},[72],{"text":73,"type":26},"After deactivating this setting, the tags are now firing in the right order.",{"type":22,"content":75},[76,78,79],{"text":77,"type":26},"The next step was to set a consent mode for each of the tags based on what consent is needed for that specific tag. For example to set that a tag should only trigger when \"ad_storage\" access is granted, we do this:",{"type":55},{"type":57,"attrs":80},{"alt":59,"src":81,"title":59,"copyright":59},"https:\u002F\u002Fa.storyblok.com\u002Ff\u002F151486\u002F583x279\u002F80b428ec88\u002Fmceclip1.png","blog-entry",[84],"36c5f0a3-3461-4b49-9758-537bdda01a2c","consent-mode-in-gtm","blog\u002Fconsent-mode-in-gtm",100,[],false,152811822,"f3c18326-e654-4724-8456-6953551592a4","2022-05-17T17:54:13.000Z","default",[],1787062195291]