Adding Google analytics to your ghost publication
If you want to track user activities on your ghost publication, then Google Analytics is one of the great tools that available for free.
There are two ways to add google analytics to your ghost publication:
- Via the code injection (Fast and easy)
- Via updating your theme files (Not suitable for No-Code users)
In both cases, you will have to obtain the tracking code from google analytics. You can obtain the tracking from here https://analytics.google.com/
Via the Code Injection
- Go to your ghost admin
yourblog.com/ghost
& navigate to Setting > Code Injection - On the Site Header Section paste the tracking codes you got from google analytics.
- Hit the save button & you have successfully added google analytics to your ghost publication
Via updating your theme files
In this method first, you will have to know the location of your theme. Generally, you can download your theme from ghost admin if it's already installed on your ghost publication.
to download your theme go to ghost admin > Setting > Themes & hit the download button to download your theme
Once you have downloaded your theme to your local computer you will need a text editor to make the edits.
- Unzip the theme folder.
- Look for a file called
default.hbs
- Open the
defaul.hbs
file with a code editor for my case I am using VSCodes - Now add the google analytics tracking code right above the ending
</head>
& below the{{ghost_head}}
.
- Save the file
- Zip the entire folder again.
- Upload it to your ghost publication.
You have successfully added google analytics to your ghost publication.
Check out our themes library https://visioun.com/themes
If you want regular updates on our projects or these types of guides right to your inbox subscribe here 👉 https://visioun.com/sigup
You will also get access to our private discord Server
Thank you for reading.