Cookie Control
Positioning of Google Analytics Code (4 posts)

  1. mckendrick
    Posted 3 years ago #

    The plugin positions the Google Analytics code just before the closing body statement. According to Google the code should be placed just before the closing head statement.

    Does this matter? The reason I ask is that data does not appear to have been collected for the past few days, i.e., since I installed the plugin.


  2. austenm
    Posted 3 years ago #

    You don't need a plugin. Deactive the google plugin then click on "Appearance > Editor > select the file "header.php" in the far right column. You will find your code to edit in this file. If you know HTML, you're good to go. Just make sure your Google Analytics script block of code is pasted after other </script> tags as well as before the </head> tag.

  3. mckendrick
    Posted 3 years ago #

    The reason I ask is because the Cookie Control plugin automatically places the Analytics script at the bottom of the HTML just before the closing BODY tag (along with some of its own coding).

    Now, if the Analytics script must come before the closing HEAD tag, then Cookie Control is not doing its work properly.

  4. mckendrick
    Posted 3 years ago #


    Well, you were right. I completely removed Cookie Control and placed the Analytics script before the closing HEAD tag and now Google Analytics is tracking my visits once again.

    This means that it is invalid for Cookie Control to place the script before the closing BODY tag.

    There haven't been any replies from the author to any support requests lately so perhaps he is dropping it. Pity.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic