Ghost is the new hotness in blogging. It has more than 5,000 backers on Kickstarter and has raised more than USD $300,000 in funding. But given its relatively new on the block, there's not a lot in the way of tutorials or primers for getting started.
Looking at the world of analytics, there are a few tutorials on page one of Google which encourage users to customize Ghost themes. But customizing a theme is a hack and locks users into something I like to call a “customization corner”. Customizing in the way suggested makes it more difficult for users to switch themes later and increases the risk of functionality breakage when one theme is swapped out for another. Don't do it.
Instead, consider adding analytics using a CDN like CloudFlare. Not only does adding analytics through a CDN prevent the need to customize Ghost, it'll also speed up your blog at the same time and can be done without any coding. And the best part is, it can be done for free.
To add Google Analytics to Ghost with CloudFlare without customizing your theme or writing any code follow the steps below.
Get Tracking ID from Google Analytics
First, get a Tracking ID from Google Analytics.
- Create a Google Analytics account if one does not already exist.
- Follow Google's instructions to set up a property.
Once a new property is set-up, a Tracking ID (e.g.
UA-6273863-4) will become available as part of the code snippet provided to add analytics to a blog. Copy it somewhere or just come back for it once CloudFlare is set-up.
Set tracking code in CloudFlare
Tracking ID is generated in Google Analytics it can be used to start tracking data on a Ghost blog through an integration with CloudFlare. Follow the steps below to make it happen. No coding required!
If one does not already exist, create an account with CloudFlare.
Once logged into your CloudFlare account, add a new website from the Account Dashboard page.
After the new website is added, access the Apps section of the CloudFlare Dashboard for the website.
From there find Google Analytics and enable it using your Google Analytics
Tracking IDcreated earlier.
Once the tracking code is set in CloudFlare data should begin to flow through to Google Analytics automatically. Test it out in Google Analytics by accessing the real-time page tracking while navigating the Ghost blog.
When it's verified, don't forget to also hook the blog up to Webmaster Tools using CloudFlare, and then submit the site to the search index.
Without a lick of code or a penny spent I've shown you the steps needed to add Google Analytics to a Ghost blog without customizing a Ghost theme or writing any code. Happy blogging!