Adding of Google Analytics code to my WP site

by 6 replies
7
Hello,

I would like to add the Google Analytics code to my WP site, namely the homepage, but I am not sure where/how to add it. You see, I have a few domains registered on my cpanel and when I access that site's file (public_html....), I am at a loss as to which file to locate to add the code.

Any assistance would be appreciated, as I would like to add it ASAP, thanks.

Sincerely,

DK
#programming #adding #analytics #code #google #site
  • You actually don't need to use the files.

    Login to wordpress and go to the templates section.

    Edit the current template that you are using, and you can add it in.

    If you are just looking to add it to a sidebar area, you can download the Text Widget

    Text*Widget — Support — WordPress.com

    and you can just paste in your adsense code to there.

    Any more questions?

    If you are trying to just put them in your sidebar, you should do that. For the most part, if you feel like editing the files, you only need to do the templates, which are located at public_html/wp-content/themes.

    If you have different domains, they should be stored in their own separate directories, with your main domain routing to /public_html.

    Any more questions?

    -Tyler
    • [1] reply
    • Hello,

      Many thanks for the prompt and detailed reply, much appreciated.

      I logged into my WP Dashboard and accessed the themes>templates section, but I am still a bit confused, since I want to add the code to the homepage of the site, do I add it to header.php or index.php? The code has to be immediately before the closing </head> tag, so I think it might be header.php, but just wanted to get some clarifications first, thanks!

      DK
      • [1] reply
  • normally you would want analytics on every page of your website.
    the easiest way is to install a wordpress plugin to do this.
    I normally use analyticator plugin, but there are many others.
    • [1] reply
    • Yeah. I normally use StatPress and have never really had any problems with it.

      I would try it out if it is for a personal site, or a site that you update often.

      If you have multiples that you are tracking, I guess you could use GAnalytics -_-

      But its more of a preferential thing.

      Analyticator is nice too.

      -Tyler
  • There's a difference between analytics and webmaster tools. The former really want to be on every page, a free plugin will do the job as suggested above. The webmaster verification code just needs putting in the head section so you can edit the header.php of your current them.

    Believe you only need do this once per site, could be wrong though.

Next Topics on Trending Feed

  • 7

    Hello, I would like to add the Google Analytics code to my WP site, namely the homepage, but I am not sure where/how to add it. You see, I have a few domains registered on my cpanel and when I access that site's file (public_html....), I am at a loss as to which file to locate to add the code.