Created
March 23, 2021 10:34
-
-
Save chavesm/9ff2876b4e4f8468fc22dec959eb26a7 to your computer and use it in GitHub Desktop.
Use MonsterInsights filter hook to set Didomi Web API attributes to control tracking based on visitor consent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // This line is not needed for functions.php. | |
function monsterinsights_eu_compliance_tracking_didomi( $attributes ) { | |
$attributes['data-vendor'] = "didomi:google"; | |
$attributes['type'] = "didomi/javascript"; | |
return $attributes; | |
} | |
add_filter( 'monsterinsights_tracking_analytics_script_attributes', 'monsterinsights_eu_compliance_tracking_didomi' ); | |
/** Add this PHP filter hook to your child theme's functions.php file or use a plugin like Code Snippets. */ | |
/** | |
Consult Didomi developers docs for specifics: | |
https://developers.didomi.io/cmp/web-sdk/third-parties/custom-integrations/no-tag-manager | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment