Skip to content

Commit

Permalink
Update docs for Google Consent Mode v2 (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jako committed Mar 13, 2024
1 parent b2231eb commit b445369
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 9 deletions.
42 changes: 40 additions & 2 deletions en/02_ConsentFriend/v1/02_Functionality/02_Default_Services.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,44 @@ setting has to be created by yourself:
</script>
```

#### Callbacks

#### On Init

```
function (opts) {
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
```

#### On Accept

```
function (opts) {
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'granted'});
}
```

#### On Decline

```
function (opts) {
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
```

This service can be imported with the [Google Analytics service YAML
file](../yaml/consentfriend_googleAnalytics.yml)

Expand Down Expand Up @@ -284,7 +322,7 @@ file](../yaml/consentfriend_facebookPixel.yml)
window.gtag = function () {
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
gtag('set', 'ads_data_redaction', true);
}
```
Expand Down Expand Up @@ -324,7 +362,7 @@ file](../yaml/consentfriend_facebookPixel.yml)
window.gtag = function () {
dataLayer.push(arguments)
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'})
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'})
gtag('set', 'ads_data_redaction', true)
}
```
Expand Down
12 changes: 11 additions & 1 deletion en/02_ConsentFriend/v1/08_FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ link to the consent management window using the following code:
<a onclick="klaro.show(window.consentFriendConfig, { modal: true });return false;">[[%consentfriend.services.change_setting? &namespace=`consentfriend`]]</a>
```

## How can I change external html code automatically for ConsentFriend
## How can I change external html code automatically for ConsentFriend?

It is possible to replace the html code of i.e. YouTube videos in a placeholder
with the following output filter. Create a snippet FilterConsentFriendVideo with
Expand All @@ -91,3 +91,13 @@ return preg_replace(
```

Feel free to create your own output filter for other external services.

## Is it possible to use Google Consent Mode v2 with ConsentFriend?

Yes, the consent mode v2 can be set with ConsentFriend for Google Analytics. It
is now built into the default Google Analytics service configuration. In already
existing installations you can install the new code by importing the [Google
Analytics service YAML file](yaml/consentfriend_googleAnalytics.yml) or just
add the
[callbacks](https://docs.treehillstudio.de/en/consentfriend/02_Functionality/02_Default_Services/#callbacks)
on your own.
31 changes: 29 additions & 2 deletions en/02_ConsentFriend/v1/yaml/consentfriend_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,33 @@ services:
</script>
code_section: 0
callback: ''
on_accept: |
function (opts) {
console.log('accept');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'granted'});
}
on_init: |
function (opts) {
console.log('init');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
on_decline: |
function (opts) {
console.log('decline');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
active: false
default: false
required: false
Expand Down Expand Up @@ -324,7 +351,7 @@ services:
window.gtag = function () {
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
gtag('set', 'ads_data_redaction', true);
}
on_decline: |
Expand All @@ -335,7 +362,7 @@ services:
window.gtag = function () {
dataLayer.push(arguments)
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'})
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'})
gtag('set', 'ads_data_redaction', true)
}
active: false
Expand Down
27 changes: 27 additions & 0 deletions en/02_ConsentFriend/v1/yaml/consentfriend_googleAnalytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,33 @@ services:
</script>
code_section: 0
callback: ''
on_accept: |
function (opts) {
console.log('accept');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'granted'});
}
on_init: |
function (opts) {
console.log('init');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
on_decline: |
function (opts) {
console.log('decline');
window.dataLayer = window.dataLayer || [];
window.gtag = function(){
dataLayer.push(arguments);
}
gtag('consent', 'update', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
}
active: false
default: false
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ services:
window.gtag = function () {
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
gtag('set', 'ads_data_redaction', true);
}
on_decline: |
Expand All @@ -48,10 +48,10 @@ services:
// a custom event in GTM to unload the service if consent was denied.
window.dataLayer = window.dataLayer || [];
window.gtag = function () {
dataLayer.push(arguments)
dataLayer.push(arguments);
}
gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'})
gtag('set', 'ads_data_redaction', true)
gtag('consent', 'default', {'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied'});
gtag('set', 'ads_data_redaction', true);
}
active: false
default: false
Expand Down

0 comments on commit b445369

Please sign in to comment.