Getting tracking into wordpress blog (google analytics)

13 replies
Hi I have recently started a blog with wordpress and I want to track how many visitors i get using google analytics.

I am on the homepage of my blog and I have right clicked, gone to view source and tried pasting in the code from the google analytics. However I can't insert my cursor into the code and it is not allowing me to paste anything.

How do i get the code from google analtics into my wordpress blog please?
#analytics #blog #google #tracking #wordpress
  • Profile picture of the author Leslie B
    Hi,

    You don't add that in the source file you find this way. What you do is this: you either use a plugin to make it easy for you, if you're not too sure about how to add extra codes in your theme files. If you rather don't use too much plugins, you add the analytics code in the footer file of your theme. You can do that via the theme editor in your wp-admin (which I don't recommend, in the best setting this wouldn't be writable for security matters) or via your file manager in your cpanel.

    Leslie
    Signature
    Taking it one day at a time!
    {{ DiscussionBoard.errors[2601135].message }}
  • Profile picture of the author Leslie B
    What hosting do you use? I use Hostgator, so doing a search for file manager (ctrl-f) should bring it up. If you have another hosting, it might have another name.

    Leslie
    Signature
    Taking it one day at a time!
    {{ DiscussionBoard.errors[2610855].message }}
    • Profile picture of the author Emogen
      A plugin is the quickest way if you are not experienced with cpanel hosting etc,

      In Wordpress admin do the following
      1. Click Plugins on the left bar
      2. Click Add New which appears next to the plugins heading
      3. Search for Google Analyticator
      4. Click Install
      5. Click Activate
      6. Scroll down and find the plugin and click settings
      7. Paste you analytics code in the box that asks for it
      8. Save the settings at the bottom of the page
      {{ DiscussionBoard.errors[2611004].message }}
  • Profile picture of the author int-mark
    Thanks Leslie

    Emogen - Thank you also for your information, that was very helpful. I have some additional questions for you though as I am not sure that I have set it up properley!

    I have done everything you said. However when I got to the google analyticator settings (step 7) I am not sure whether I put the code in the right box. There are two boxes for code

    1) Additional tracking code
    (before tracker initialization):

    2)Additional tracking code
    (after tracker initialization):

    However neither of these seems to be appropriate? I put code into the first box, put in my google analytics profile id and pressed save changes like you said. After this I tried to access analytics from the plugin itself and from going to google analytics but my blog was still not being tracked.

    So in summary:

    1)Did I put the code in the right box
    2)How do I know if it is being tracked correctly?

    Many thanks, Mark
    {{ DiscussionBoard.errors[2631612].message }}
  • Profile picture of the author Tim Franklin
    Hi, you know I have tried the plugins and they never produced the results that you get by simply putting the code into the footer.php file,

    it is simple and the footer loads every page, unlike the plugin, which may or may not load it, and it may or may not track it, the plugin is not reliable.

    put it into the footer.php file
    Signature
    Bitcoin | Crypto | Blockchain Secrets |
    {{ DiscussionBoard.errors[2631626].message }}
  • Profile picture of the author Istvan Horvath
    You don't need a plugin for this. Period. Don't use plugins for things that you can do manually. Plugins, usually, are resource hogs and slow down your blog.

    Want an online presence? It's time to learn the "webmaster basics 101": editing a simple file and uploading it via FTP.
    Signature

    {{ DiscussionBoard.errors[2631642].message }}
  • Profile picture of the author int-mark
    ok thanks for advice

    Tim - How do I put it in the footer.php file?
    {{ DiscussionBoard.errors[2631721].message }}
  • Profile picture of the author int-mark
    PS I have gone to one of my posts and pressed HTML and looked for the footer.php file but have been unable to find it.

    Thanks once again for all the comments.
    {{ DiscussionBoard.errors[2631727].message }}
    • Profile picture of the author Tim Franklin
      Originally Posted by int-mark View Post

      PS I have gone to one of my posts and pressed HTML and looked for the footer.php file but have been unable to find it.

      Thanks once again for all the comments.
      just a second I will do a short video for you, and you can see how to do it step by step, will take about five min or so to do it, so hang tight,
      Signature
      Bitcoin | Crypto | Blockchain Secrets |
      {{ DiscussionBoard.errors[2631764].message }}
    • Profile picture of the author JohnMcCabe
      Originally Posted by int-mark View Post

      PS I have gone to one of my posts and pressed HTML and looked for the footer.php file but have been unable to find it.

      Thanks once again for all the comments.
      You have to go into your control panel for Wordpress. On the left side, you should see a list of menu items under "Appearance". Click "Editor".

      (Istvan, I know modifying the file on your own computer and uploading it is better, but he needs to take baby steps here.)

      On the right side, you should see a list of your template files. Look for "Footer (footer.php)". Click it. This will load the contents of the file into the editor.

      Look for "</body>" in the code for the footer. Paste your GA code just above this line. Click the button that says "Update file".

      If you look at any of your posts or page and view the source, you should see your analytics code near the bottom of the page.

      Now it's time to do as Istvan suggests and learn some really, really basic webmaster skills...
      {{ DiscussionBoard.errors[2631775].message }}
    • Profile picture of the author tpw
      Originally Posted by int-mark View Post

      PS I have gone to one of my posts and pressed HTML and looked for the footer.php file but have been unable to find it.

      Thanks once again for all the comments.

      Just use your WordPress back-end... Go to Appearance - Editor - footer.php



      p.s. On learning HTML, keep this one important lesson in mind... So long as you keep secure backups, every mistake can be fixed with a FTP file upload...

      When you realize that all mistakes are easily fixed, learning comes much more easily...

      The only thing you have to fear is fear itself...
      Signature
      Bill Platt, Oklahoma USA, PlattPublishing.com
      Publish Coloring Books for Profit (WSOTD 7-30-2015)
      {{ DiscussionBoard.errors[2631778].message }}
  • Profile picture of the author ezimedia
    HI

    Do search for this free plugin..

    Ultimate Google Analytics

    Thx
    Tom
    {{ DiscussionBoard.errors[2631934].message }}

Trending Topics