Support » Fixing WordPress » Google Analytics Code

  • Hey! guys I have installed breakingnews theme on my website can you tell me where should paste google analytic code in the theme

Viewing 10 replies - 1 through 10 (of 10 total)
  • footer.php

    just above the </body> tag

    Moderator t-p

    (@t-p)

    – you place it between the <head> and </head> tags.

    – Alternately, here is a plugin you might find interesting:
    http://wordpress.org/extend/plugins/google-analytics-for-wordpress/

    People, it’s no help at all to say “Put it in footer.php just above the </body> tag” unless you also tell where to find footer.php. My theme has a footer, but WHERE DO I FIND THE CODE FOR IT?

    It’s no help at all to say “place; it between the <head> and </head> tags — that’s what the google analytics “help” page says. It was meaningless there and it’s equally meaningless when you repeat it here. WHERE DO YOU FIND THOSE TAGS?

    Sure, I can hit CTRL-U and view the source code for the page in the browser, but I can’t edit that.

    I see that you are frustrated and annoyed, if I were you I’d ask for a refund.

    eeeek.

    The code is in your theme. your opening and closing head tags are probably in header.php, your opening body tag is probably there too. Your closing body tag is probably in footer.php

    I say probably because it’s theme dependent. Thats how most themes are set up

    Thanks for replies.

    @cwmb4, thanks for the chuckle you gave me. I needed that gentle poke (refund on free software, hee-hee!) to reset my perspective.

    @voodoo, I spent about twenty minutes trying to find header.php and footer.php with no luck (and probably another twenty minutes before that reading these forums where nobody tells where to look!). Maybe in some themes it’s easy and obvious but I still have no idea where these php files are found.

    Gave up and loaded the plugin recommended by t-p above (thank you!). Took about 5 minutes, and another 20 (spent doing other things) for Google Analytics to get caught up.

    My advice for anybody with the question of where to put the analytics code: FORGET ABOUT IT. Don’t bother. Get a plugin.

    How to get a plugin for Google Analytics:

    1. In your WordPress Dashboard, find Plugins (I can’t tell you how; on my screen, it’s on the left)
    2. Click the down arrow to the right of Plugins to open that menu
    3. Click Add New to open an Install Plugins page
    4. In the search field, set the type to Terms (if it isn’t already) then enter Google Analytics and click Search
    5. This will open a list of possible plugins.
    6. Search through and find one that is well rated, tested for your version of WordPress, and will do what you think you need. Click Details to read about each plugin. Some are very simple, others seem to offer an incredible number of features and tweaks.
    7. When you find one that looks good, click Install Now. Follow any onscreen instructions to activate and set up the plugin and to verify at Google Analytics.

    It may take up to 24 hours before GA links to your site, sez GA.
    That’s it. You’re finished.

    just fyi, as you may need to do other edits in the future…

    header.php, etc are theme files

    To find them, you would go to appearance->editor

    All your theme files are available from there, listed on the right of the editor screen

    If you are inexperienced with code though, plugins may be the way to go. It’s easy to break a theme if you are unsure of what you are doing.

    @voodoo

    Thank you — that’s getting closer to the kind of directions newbies need.

    I found an Editor under Appearance and it does in fact open a list of files, including header.php. However, using the browser search function, I learned that header.php does not contain the tags <head> or </head>. Nor does Footer.php contain a </body> tag as somebody above said.

    I did find both the </head> tag and the </body> tag in the main index template, index.php. It took another few minutes of searching to locate it.

    So the specific sequence of directions for pasting the GA code is

    1. Go to the dashboard of your WP theme
    2. Locate Appearance > Editor
    3. In the list of files, see if you can find header.php. If so, click on it, and use the browser search function to find </head>.
    4. If header.php is not there, or does not contain </head>, try each of the other php files in turn.
    5. When you find </head>, paste the Google Analytics code on the line just above it.

    Does that look accurate and correct?

    @graywriter
    I feel your frustration. Long ago I learned how to do simple pages in Dreamweaver. Head tags were at the top of the page, body information was in the body, and the footer was at the end of the page. Trying to remember how WordPress breaks up all these elements into sub menus like Appearance->Editor->Header.php->*now you can fix the code* is not how I was originally trained to think. Learning & un-learning new programs is always a challenge.

    @voodoo – that’s exactly what people need. It’s like trying to find a file in Windows XP vs Windows 7 – the file hierarchy is completely different than where your stuff has been for the last 15 years.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Google Analytics Code’ is closed to new replies.