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).

To use Cookiebot with Google Analytics for WordPress by MonsterInsights to enable prior consent (block GA cookies until the user has consented to statistic cookies), edit the plugin file under your plugins directory in Wordpress as described below. 

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.


Feedback and Knowledge Base