I've just installed WP and setup my google analytics account. In the instructions, google says this:
Copy the following code block into every webpage you want to track immediately before the </body> tag.
In the options of the plugin, by default the code shows up in the header of all my HTML files. If I enable "Footer" then it puts the code immediately after the </BODY> tag. Is this going to cause any problems reporting?
Thanks!
Blue
Hello Blue,
I have yet to here of any adverse effects from anyone having the Google Analytics code after the </body> tag.
Unfortunately, I have no control over where the code is placed in the footer. It's up to a template tag called wp_footer(). In some themes it's before the </body> tag, other themes it's after.
If the placement bugs you, you can change it yourself. Just open up your theme's footer.php file and move the <?php wp_footer(); ?> section before the </body>. Hope that helps!
so get_footer() not supported anymore?
course as i understand if footer required by funciton get_footer() GA wouldn't work.
isn't it better?
if (get_option(key_ga_footer) == ga_enabled) {
add_action('wp_footer', 'add_google_analytics');
add_action('get_footer', 'add_google_analytics');
} else {
add_action('wp_head', 'add_google_analytics');
add_action('get_header', 'add_google_analytics');
}