Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Die einfachste Methode, Javascript an der Ausführung ohne Consent zu hindern, ist eine kleine Anpassung, wodurch der Browser das Script nicht mehr als solches interpretiert:

In den Skripten muss der Typ von The simplest way to prevent Javascript from executing without Consent is to make a small adjustment, whereby the browser no longer interprets the script as such:

In the scripts the type must be changed from type="text/javascript" zu  to type="text/plain" getauscht werden. Sollte im Script der Typ . If the type "text/javascript" nicht explizit angegeben sein, da es auch ohne Nennung vom Browser interpretiert werden kann, muss dennoch type=”text/plain" ergänzt werden.

Cookiebot kann diese Scripte mithilfe eines festzulegenden Attributes erkennen und bei Einwilligung den Typ von text/plain zurück auf text/javascript stellen. Für eine Korrekte Zuordnung muss daher zusätzlich ein “Data-Attribute” hinzugefügt werden:

Dieses Data-Attribute ist nach dem Prinzip data-cookieconsent="[Cookie-Kategorie]" aufgebaut, wobei "Cookie-Kategorie" einer der im Cookiebot genutzten Kategorien entsprechen muss. Der Cookiebot arbeitet über die 3 Kategorien Präferenzen, Marketing und Statistiken. Die zugehörigen Werte sind folgende:

...

Kategorie

...

eindeutige Bezeichnung

...

Code Anpassung

...

is not explicitly specified in the script, because it can also be interpreted by the browser without being named, type="text/plain" must still be added.

Cookiebot can recognize these scripts with the help of an attribute to be defined and set the type from text/plain back to text/javascript if consent is given. For a correct assignment, therefore, a "data attribute" must also be added:

This data attribute is structured according to the principle data-cookieconsent="[cookie-category]", where "cookie-category" must correspond to one of the categories used in the Cookiebot. The Cookiebot works with the 3 categories of preferences, marketing and statistics. The associated values are as follows:

Category

unique identifier

Code adjustment

Preferences

preferences

type=”text/plain” data-cookieconsent="preferences"

Marketing

marketing

type=”text/plain” data-cookieconsent="marketing"

StatistikenStatistics

statistics

type=”text/plain” data-cookieconsent="statistics"

Hinweis: Es kann auch eine Kombination von Kategorien genutzt werden. Beispielsweise Note: A combination of categories can also be used. For example, data-cookieconsent="statistics, marketing"

...

Example:

Ein Beispiel anhand des An example using the Google Analytics Scripts. Dieses ordnen wir der Kategorie “Statistiken” zuscript.We assign this to the category "Statistics".

Original:

Code Block
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
 
  gtag('config', 'UA-XXXXXXXX-X');
</script>

AngepasstAdjusted:

Die Anpassungen waren in Zeile 1 und Zeile 2 notwendigThe adjustments were necessary in line 1 and line 2.

Code Block
<script type=”text/plain” data-cookieconsent="statistics" async src="https://www.googletagmanager.com/gtag/js?id=UA-XXX"></script>
<script type=”text/plain” data-cookieconsent="statistics">
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
 
  gtag('config', 'UA-XXXXXXXX-X');
</script>