How to Add Google Analytics To Ghost Blog

Jan 12, 2014 by | 2 Comments

Google Analytics is one of the most important tool for a blog. Writing a blog without Google analytics is like through a stone at dark. If you through a stone to the target at dark, you will not see the result. Like that, you have a nice site, you write well; fine. But without analytics you will not know if people really reading your post or like you. Google analytics will help you to track your website visitors, let you know from where they come from, which friend are referring others to read yours writings. Isn’t it Cool?

As ghost is new and we have not any plug ins to set up analytics dynamically, so we have to do this manually. First we need to sign up for google analytics then we’ll put the code at blog.

Sign up for google Analytics:

1. To sign up you must need a Gmail account. Now visit Google Analytic. If you have an Analytic account already then Sign in. Or if you don’t have account yet, Click “Create an Account”. And fill the form to sign up.


2. Once you sign up go to your admin page. At the left column you have account list. Click there and click “Create new account”.


3. Now we are going to add the website. Make sure at the upper tab the website is selected. Then select the free or premium plan that you want. I have not see any blogger using premium plan (!) Any way fill the form with your web site name, URL, Account name (May the website name or if have any special) and reporting time zone.



4. Now click the “Get Tracking Code” button. A pop will come, agree with the term.

5. Then browser will lead you to the where you will get JavaScript codes to paste into your website page that you want to track. Copy that code.



Adding Code at Ghost:

We do not have any plug ins to add Analytics code from dashboard. So now we are going to write some complex JavaScript! I am kidding. let’s do this through server-

1. Go to your cPanel and then then ghosthtdocscontentthemes and last open theme folder.

2. Now open the default.hbs file with any text editor. And paste the code before in <head> tag but before {{ghost_head}}. Like:



You are done. Tomorrow you log in to your analytics account and see your traffic result at awesome interface. It takes maximum 24 hours to show you result. If you have very new website that have no traffic then you may not see any analytics.



A freelance Web Designer. Loves to share code experience with others and here from the readers.

2 Responses to “How to Add Google Analytics To Ghost Blog”

  1. Antony says:

    how about if I host my website on ghost? not on my computer?

    • Rahi says:

      Ghost has started their hosting service. And some other hosting has started one click installers. So, That can help you.

Leave a Reply

© 2013 StupidCoedz. All rights reserved.