Google Tag Manager
You can integrate ConsentFriend with the Google Tag Manager (GTM) quite easy and control consents for i.e. Google Analytics with ConsentFriend via the GTM. The demo callback scripts of ConsentFriend in the googleTagManager service already contain the necessary code for this.
To set up Google Analytics with Google Tag Manager in ConsentFriend, first edit the googleAnalytics service and delete the code block in the code tab there. This important step also applies to all other services that you want to control via GTM. You only need to list the cookies that these services set.
Now create a Google Analytics tag in the GTM web UI. As a trigger, create a
custom event trigger
named consentfriend-googleAnalytics-accepted. This will ensure that GTM only
loads the Google Analytics service if the user has given consent for it via
ConsentFriend. And that's it!
If you want to track Google Ads, you must change the Consent Mode v2 settings
'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalisation':
'denied' in the On Accept callback to 'granted' in each case.
ConsentFriend now manages GTM and ensures that only services that the user has given consent for via ConsentFriend are loaded. Once you have completed the setup of GTM with the selected services, please delete the console.log entries in the On Accept/On Decline callbacks from the Google Tag Manager service.
Important! To add another service via GTM, first enable or create a service in ConsentFriend and simply define a custom event trigger of the form
consentfriend-[service-name]-accepted, where[service-name]is the name of the service in the ConsentFriend configuration.