My thoughts on lots of random things,ranging from Sys Admin and Programming, through to Travel and Lifestyle.
January 9, 2012 by Mícheál

WordPress, Google Analytics and Plugins

Today I spent a little bit of time adding Google Analytics in to the site, and found a few things that took some digging to set up. Setting up a Google Analytics account is easy, and all you have to do is add some javascript similar to this (obviously the account and domain name will be different:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-28114660-1']);
  _gaq.push(['_setDomainName', 'michealhalpin.com']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Basically this code is used by Google to track the visitors to your site. On a self-hosted wordpress site like this one it’s very easy to add, I simply added this in to the header.php file. Simples!

But since I have 2 blogs, this one which runs WordPress.org software, and my cycling blog which is hosted on wordpress.com I thought I would add the functionality to the cycling blog. Because they both run WordPress I thought they would be identical: I was wrong.

Basically wordpress.com is used to host and deploy wordpress sites rather quickly. Basically it’s an all-in-solution.

WordPress.org however is different in that this is the CMS engine that you use to run your own site, on a different host. It’s more basic out of the box, and needs more to get it up and running. But the difference is that it’s a lot more customisable.

Probably one of the biggest differences is that .org sites all you to add in plugins, but the .com do not. Also you can’t edit the php files (although I stand to be corrected, I only looked at this for a few minutes earlier). (Plugins are basically small pieces of code used to add functionality to a site. For example I use the code snippet plugin to display code like the Google examples on the page. It’s a lot easier than coding the HTML manually!)

So, long story short if you want to use plugins on your wordpress site a standard wordpress.com site won’t do you, either have to get someone to host it (or host it yourself) or upgrade your wordpress account to VIP (sounds expensive)

  •   •   •   •   •

2 Responses to “WordPress, Google Analytics and Plugins”

  1. Hello,

    I miight be away out of line here. But ive been googling a problem i have for days now and coming up empty.

    Your header míchéal is displaying the fadas in the irish section in my site the whole letter is left out when a fada is put over the letter.

    Can you help me with this please? or send me a link where i can look to sort this out.
    I am ok with wp but certain coding not great.

    Would appreciate it greatly.
    Sorry for wasting your time, but i am really stuck.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>