We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Cookie Consent form and Twitter

How Do I?

Torch's avatar
Torch
40 posts
3 years ago
Torch's avatar Torch

Anyone know of any examples on how to use EE’s cookie consent add-on, to consent to Twitter tracking code triggered by Google Tag Manager?

       
Rob Allen's avatar
Rob Allen
3,105 posts
3 years ago
Rob Allen's avatar Rob Allen

A bit of self promotion but I wrote an EE:U article about Consents at https://u.expressionengine.com/article/a-consent-module-primer

There are numerous ways to do this but what you could is create a consent for your tracking code and use that consent to allow code to be added.

Here’s a rough example with a consent called “ee:twitter”…

{!-- consent form tag  --}
{if ! consent:has_responded:ee:twitter}
{exp:consent:form consent="ee:twitter"}

  {!-- pass the consent value in a hidden input --}
  {consents}
    <input type="hidden" name="{consent_short_name}" value="y">
  {/consents}

  {!-- HTML --}
  Allow Twitter surveillance scripts?

  {!-- submit button--} 
  <button type="submit">Yes please!</button>

{/exp:consent:form}
{/if}

{!-- show the content after the form has been submitted --}
{exp:consent:requests consent="ee:twitter"}
  {if consent_granted}

    [YOUR-CODE-HERE]

  {/if}
{/exp:consent:requests}
? 1
       
Rob Allen's avatar
Rob Allen
3,105 posts
3 years ago
Rob Allen's avatar Rob Allen

I might add that local laws may require you to get consent for the whole GTM script snippet because it can track people by itself.

       
Torch's avatar
Torch
40 posts
3 years ago
Torch's avatar Torch

This is a huge help, exactly the type of explanation I needed! Thank you. I’ll share what I do end up coming up with on the GTM integration.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.