WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Where should I paste the Google analytics code? (5 posts)

  1. mkpoway
    Member
    Posted 3 years ago #

    Hi all,

    I'm wondering which file I should paste my Google analytics code into. I've been pasting it into the Main Index Template (index.php), before the first <?php tag, but perhaps it should go somewhere else?

    Thanks!

  2. baghtal
    Member
    Posted 3 years ago #

    as long as it comes before the </head> line you should be okay...

    My suggestion would be to use a widget (my personal favorite is Google Analyticator... http://ronaldheft.com/code/analyticator/) it will be seamless and add a quick-view to your admin dashboard.

    In general using plugin's are a good way to go about getting the things you want done while you wrap your head around how to use PHP.

    good luck :)

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    as long as it comes before the </head> line you should be okay...

    Huh? The analytics code is best placed in footer.php - just before the </body></html> tags.

  4. baghtal
    Member
    Posted 3 years ago #

    Oh I see. Because in the footer the site can begin to render before it's all loaded.

    Thanks :)

  5. mkpoway
    Member
    Posted 3 years ago #

    Thanks, got it!

Topic Closed

This topic has been closed to new replies.

About this Topic