Google Analytics is a great tool to learn about the traffic your website has acquired. You can use it to learn the visitor statistics, demography, behavior, to the technologies used by your visitors. You can install Google Analytics on your website regardless of the CMS you use. Ghost is no exception.
Installing Google Analytics in Ghost requires two main steps:
- Getting the tracking code
- Pasting the tracking to your website
In Ghost, you can paste the tracking code to either the header or the footer of your website. You can paste the tracking code to one of these site parts as they are loaded on every Ghost blog (be it static pages or blog posts).
Installing Google Analytics in Ghost
Step 1: Get the Tracking Code
To get the tracking code, you need to have a Google Analytics account. To create the account, visit the Google Analytics page and login with your Google account. Once successfully logged in, you can click the Start measuring button.
On the next screen, you will be prompted to enter your name. Simply enter your name and click the Next button.
You can skip the steps above if you already have a Google Analytics account. Instead, you can login with your account. Once logged in, click the gear icon on the bottom-left corner and click the Create Property button on the middle column to create a new property.
Give your property a name and click the Next button.
There are some questions you need to answer on the next screen. From the number of people on your business to how you plan to use Google Analytics. Simply answer all questions and click the Create button.
Next, select the platform to collect the data from. Since you want to install Google Analytics on Ghost, you can choose the Web option.
Type your site URL on the Website URL field (without http(s)://) as well as your website name on the Stream name field. Click the Create stream button.
After clicking the Create stream button above, you will be presented with a dialog window. Open the Global site tag option and copy the code (your Google Analytics tracking code has been included in the code).
Step 2: Paste the Tracking Code to Ghost
Once you have copied the tracking code, you can login to your Ghost dashboard (yourblog.com/ghost). Once logged in, click the gear icon on the left panel to open the Settings screen. Select the Code injection on the Settings screen.
Select a location where you want to paste the tracking code (header or footer) and simply paste the code to the available fields. Click the Save button on the top-right corner after pasting the code.
It takes time for Google Analytics to gather the data of your visitors on your website. So, you will see empty data when logging in to Google Analytics right after adding the tracking code to your website.
In addition to Google Analytics, you can also install Google Search Console on your Ghost website to learn the performance of website on Google. If your website is hosted on Ghost.org, it is also crucial to set up a custom domain.