Monday, 27 April 2009

Tracking your Blog

Once you have a blog setup, the next thing you should do is track the traffic to your website. This allows you to understand how many people are viewing your content and how much traffic its getting.

There are many services on the internet that allow you to track the traffic to a website. I will just name a few:
Since I am using Blogspot/Blogger which is a Google product, I decided to use Google Analytics.

Setup

Google Analytics is really easy to setup. I found this blog which explains how to setup Google Analytics for a Blogspot Account.
Setup is really very simple.
These are the steps at a very high level:
  1. Sign up for a Google Analytics account.
  2. Copy the code snippet from Google Analytics into your blog. This allows it to be tracked by Google.
  3. Go to Google Analytics and check that the snippet has been deployed correctly. I read somewhere that you have to allow 24 hours for Google to initialise things before you will be able to view some results.

Results
I was very impressed with the results that Google Analytics provides.
  • Simple and easy to understand graphs and data.
  • But also allows you to drill down into more detail.
  • There are lots of different KPI (Key Performance Indicators) which you can use.
  • Shows from which part of the World the viewer came from.
  • And lots more other interesting details

Tuesday, 21 April 2009

Linux Shell Script - Changing Directory

I found out that changing directory in the shell script file does not affect the shell in which it was called.
When you run a shell script, the script in run in another shell session.

I will explain with an example.

This is the contents of my script, which is called "mymkdir":
#!/bin/bash
mkdir $1
cd $1


So the goal of this script was to create a new directory and the name of this will be passed in as parameter. And afterwards we would like to change into that directory.
But if you try and run this script nothing will happen. It will create the new directory, but it wont change into that directory. You will remain in the same location.
This is how I ran the script:
> mymkdir newFolder

Solution
To use the keyword "source" before running the script.
> source mymkdir newFolder

Now it should work as expected. A new directory called "newFolder" has been created and the shells present working directory is now inside the new folder.