#1

derFuchs

Forum-Sponsor  (98 Punkte)  ·   männlich  ·   Deutschland  ·   Nachricht senden
 https://www.gummishop24.com

Hallo,

habe erfahren, dass man bei Nutzung von Google Analytics abmahngefährdet ist, wenn man nicht eine opt-out Funktion einbaut.

Laut Google muss dieser Code eingebaut werden.


Nun der Hinweis von Google:

Here's a simple example of some code you can use to provide opt-out functionality for your users.

First, add a new HTML link to your site to execute the opt-out logic:

<a href="javascript:gaOptout()">Click here to opt-out of Google Analytics</a>


Das bekommt man noch leicht hin, indem man einfach einen HTML Absatz an die entsprechende Position in der Datenschutzerklärung einfügt.


Then add the following snippet of code before the ga.js code snippet. Make sure to replace the value of gaPropertyfrom UA-XXXX-Y to the property used on your site. This is the same value that you pass to the _setAccount command.

<script>
// Set to the same value as the web property used on the site
var gaProperty ='UA-XXXX-Y';
 
// Disable tracking if the opt-out cookie exists.
var disableStr ='ga-disable-'+ gaProperty;
if(document.cookie.indexOf(disableStr +'=true')>-1){
  window[disableStr]=true;
}
 
// Opt-out function
function gaOptout(){
  document.cookie = disableStr +'=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  window[disableStr]=true;
}
</script>


When a user clicks the opt-out HTML link, the custom gaOptout function will execute. It will set a cookie for a long time in the future and disable analytics.js data collection. When a user returns to this site, the script above will check to see if the opt-out cookie has been set. If it has, then the analytics.js data collection will also be disabled.


In welcher Datei und an welcher Position mache ich dies? Habe schon mit der google_analytics.ccml in \common gebastelt, aber das hat nicht funktioniert.

Danke.

Gruß
Bernd

#2

Volker W.

Administrator  (7794 Punkte)  ·   männlich  ·   Deutschland  ·   Nachricht senden
 https://www.warmers.de  ·   vwarmers  ·   vwarmers  ·   volkerw68

In der navigation.ccml des von Dir verwendeten Designs.


Suche darin nach:

<cc:if cond="&site.googleanalytics.accountnumber"><cc:include src="google_analytics.ccml" common="1"></cc:if>


Und ersetze dies dann komplett mit:

<cc:if cond="&site.googleanalytics.accountnumber">
<script>
// Set to the same value as the web property used on the site
var gaProperty ='<cc:print value="&site.googleanalytics.accountnumber">';
 
// Disable tracking if the opt-out cookie exists.
var disableStr ='ga-disable-'+ gaProperty;
if(document.cookie.indexOf(disableStr +'=true')>-1){
  window[disableStr]=true;
}
 
// Opt-out function
function gaOptout(){
  document.cookie = disableStr +'=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  window[disableStr]=true;
}
</script>
<cc:include src="google_analytics.ccml" common="1">
</cc:if>


Hinweis:

Ungetestet und basierend auf dem oben von Dir genannten Code.


Viel Erfolg!


Viele Grüße,
Volker

Über mich  ·  Volker W. Musik & Sounds  ·  Facebook  ·  Twitter  ·  Instagram  ·  StayFriends  ·  LinkedIn  ·  XING

#3

derFuchs

Forum-Sponsor  (98 Punkte)  ·   männlich  ·   Deutschland  ·   Nachricht senden
 https://www.gummishop24.com

Hallo Volker,

 

super - sollte funktionieren.

Vielen Dank!

 

Gruß

Bernd

514 Aufrufe | 3 Beiträge