Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've installed a plugin that puts google analytics code to the page of each post.

But it did not install google analytics code to home page and because only a small portion of users click on the post's page I can not track the users.

How can I install google analytics manually to the home page and if I do so I could not use the plug-in any more?

My theme is Twenty Ten 1.2.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This depends on your theme.

Most themes have a call the wp_footer hook at the bottom of every page - which means it's at the bottom of every single post, every single page, and the home page. Rather than editing all of your theme files to include your tracking code, use a plugin that ties in to wp_footer and adds the code there.

There's actually a plugin that will do this for you - which means you just install the plugin, no code editing is required.

Google Analytics for WordPress

I did test this exact plugin with a fresh install of Twenty Ten 1.2. It works just fine and displays the script on the home page. You must have another plugin interfering with the Google Analytics one or you've made changes to the theme that's preventing the plugin from working properly.

share|improve this answer
    
This one I've installed and when I watch the code of the home page there does not exist the google analytics code. But when I watch the code of each post's there exists. –  Novemberland Nov 18 '11 at 16:57
    
It won't track you if you're logged in unless you set that up specifically. But beyond that, I can't help you without knowing what theme you're using and how it's coded. If the homepage isn't calling wp_head and the script is targeted for the header, it won't show up. Vice-versa for the footer. But without seeing your code, I have no idea. –  EAMann Nov 18 '11 at 17:05
    
My theme is Twenty Ten 1.2 by the WordPress team –  Novemberland Nov 18 '11 at 17:09
    
I just did a test using that exact plugin and a fresh install of Twenty Ten 1.2. It works just fine and displays the script on the home page. You must have another plugin interfering with the Google Analytics one or you've made changes to the theme that's preventing the plugin from working properly. –  EAMann Nov 18 '11 at 17:16
    
You are right. I changed theme and reinstalled Google Analytics for WordPress but the problem remained. I then deactivated the plugin "WordPress Amazon Associate" which I had installed and it worked fine. Thanks! +1. If you want you can enter your last comment to your answer so other people can see your answer and would not have to check the comments, Thank you again. –  Novemberland Nov 18 '11 at 17:35
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.