MonsterInsights Analytics Wordpress Plugin
Please note that this is no longer being updated. Kindly visit the new Cookiebot support area (https://support.cookiebot.com/hc/en-us) for updated guides, articles and FAQs. If you do not find the answer to your question there, you are welcome to post it in the Cookiebot community (https://support.cookiebot.com/hc/en-us/community/topics).
If you are using Google Analytics Universal, make the following modifications (yellow markup) to the code snippet below, located towards the end of the plugin file class-tracking-analytics.php:
<script type="text/plain" data-cookieconsent="statistics"
data-cfasync="false">
// Function to detect opted out users
function __gaTrackerIsOptedOut() {
return document.cookie.indexOf(disableStr + '=true') > -1;
}
...
If you are using the older version of Analytics, Google Analytics Traditional, make the following modifications (yellow markup) to the code snippet below, located towards the end of the plugin file class-tracking-ga.php:
<script
type="text/plain" data-cookieconsent="statistics" data-cfasync="false">
var _gaq = _gaq || [];
<?php
...
In any case, remember to save the file and make sure to embed the Cookiebot consent dialog in your header.php file first.