• Resolved JiL

    (@rwa66)


    Hello,

    I installed this plugin and it is working pretty well, except that i only have one checkbox for the normal cookies. We are using Google Analytics so i need our visitors to accept those tracking cookies too.
    I read the documentation and for what I understand I have to add
    <?php if (!function_exists('coia') || coia('tracking')) { // include google analytics }?> somewhere.
    But the documentation does not mention in which file i have to add this line of code.
    Could anyone shine a light on this?
    Thanks so much in advance!

    http://wordpress.org/extend/plugins/cookie-opt-in/

Viewing 1 replies (of 1 total)
  • If you’re using a plugin to add google analytics, there is a very high probability that the code is added using a filter or action. In that case you can add a line on the settings page in the appropriate box.

    For example;
    the YOAST plugin issues an add_action("wp_head", array('GA_Filter', 'spool_analytics'))
    the third parameter (the priority) is omitted here so it is 10.
    To block this action, add the line wp_head:GA_Filter,spool_analytics:10 to the appropriate box in the settings panel of the plugin.

    If you do know the action that adds the analytics code but don’t know how to rewrite it like above, take a look at the “Actions Overview” page of the plugin settings. It’s a long list but you will find it, I’m sure.

    Now, if the code is NOT added by an action or filter, for example, it is entered in the footer.php of the theme, you can add the functioncall you mentioned around the code.

    So if it reads (something like)

    <!-- Google Analytics code starts here -->
    <script type...... (this is the actual Google Analytics code .....</script>
    <!-- GA ends here -->

    just add this one before:
    <?php if (!function_exists('coia') || coia('tracking')) { ?>
    and this one after
    <?php } ?>

    so it reads

    <?php if (!function_exists('coia') || coia('tracking')) { ?>
    <!-- Google Analytics code starts here -->
    <script type...... (this is the actual Google Analytics code .....</script>
    <!-- GA ends here -->
    <?php } ?>

    finally, you will have to turn on the ‘tracking’ cookie-type on the settings page. If you only see the one ‘functional’ checkbox, the ‘tracking’ selector is set to No instead of Yes.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Cookie Opt In] Checkboxes for tracking.’ is closed to new replies.