Created
July 14, 2022 09:41
-
-
Save LucaRosaldi/a3cdce3ab1061aa9cf54318d8655c706 to your computer and use it in GitHub Desktop.
JS: Iubenda GTM integration callback
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
/* Copy this code in "Advanced Options" > "Callbacks > "onPreferenceExpressedOrNotNeeded" textarea */ | |
/* See full explanation on: https://www.iubenda.com/en/help/1235-google-tag-manager-blocking-cookies */ | |
function(preference){dataLayer.push({iubenda_ccpa_opted_out:_iub.cs.api.isCcpaOptedOut()});if(!preference){dataLayer.push({event:"iubenda_preference_not_needed"})}else{if(preference.consent===true){dataLayer.push({event:"iubenda_consent_given"})}else if(preference.consent===false){dataLayer.push({event:"iubenda_consent_rejected"})}else if(preference.purposes){for(var purposeId in preference.purposes){if(preference.purposes[purposeId]){dataLayer.push({event:"iubenda_consent_given_purpose_"+purposeId})}}}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment