WordPress.org

Ready to get started?Download WordPress

Forums

Google Analyticator
Why is GA code not added to footer? (8 posts)

  1. Tom
    Member
    Posted 2 years ago #

    I guess the title of this post sums up my question, but I'll elaborate a little...

    Currently the GA code is inserted to the head of the site, but it's better to insert it to the footer.

    Do you have any plans to change this in a future release?

    Thanks,
    Tom

    http://wordpress.org/extend/plugins/google-analyticator/

  2. Google changed that not long ago. They now recommend adding the GA code in the header and, I'm guessing here, that's why it's added in the header.

    What you could do, however, is not use a plugin and just add the code to your footer.php.

  3. Tom
    Member
    Posted 2 years ago #

    Thanks Christine, never realised that.

    Sometimes I do add a snippet to the functions.php file to include GA code in the footer of the site (a nice clean way of adding it), but for this particular site, I'd like to use this plugin as I'd like to have the stats widget in the dashboard.

    Looks like I'm going to need to rip into the plugin's code to do so.

    Any ideas how I might go about doing it?

  4. No idea... I've never ripped open a plugin before. Personally I would live it as is and just accept the fact that the code is in the header. Google recommends having it there anyway, so.... I wouldn't lose sleep over it.

  5. cavemonkey50
    Member
    Posted 2 years ago #

    Hi Tom,

    Google highly discourages the tracking code placement anywhere but the <head> section of the HTML document. There are no disadvantages to doing so as the tracking is done asynchronously. I have a detailed FAQ explaining the placement available here: http://forums.ronaldheft.com/viewtopic.php?f=5&t=967

  6. Tom
    Member
    Posted 2 years ago #

    Thanks,

    I'll stick with it then. Just wanted to tidy it up a little. The snippet I've been using on other sites (to add it via the functions.php file, into the footer) was via Chris Coyier's "Digging into WordPress" site.

    Although that said, the post in question from which I got it from is from back in 2010 so I guess it's out-dated now.

    Thanks for the response, I'll leave it as is :)

  7. paulames47
    Member
    Posted 2 years ago #

    Hi
    Does one need to separately add the tracking code in the header.php or is the analyticator doing this by itself, using the google verifier api?

    Also, when I do ad it, it shows up on my public screen at the very top of my page, how do I prevent this, if it needs to go there?
    Thanks
    Paul

  8. matmancini
    Member
    Posted 2 years ago #

    the analytics script may be run async in the header, but pulls jQuery from the bottom and place it in the header.
    naughty naughty...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic