Google analytics allows you to analyze in-depth detail about the visitors and activities on your website. There are two ways to integrate Google analytics with Ghost.
- Using built-in code injection.
- Adding tracking code to theme files.
Integrate Google Analytics using code injection
This is the easiest way to integrate Google analytics with Ghost. Follow these simple steps to integrate GA with your Ghost blog.
- Login to the Google analytics account.
- Go to admin section.
- Click Create Property button.
- Select Web in the next window.
- Provide property details in the next page and click Create.
- Select the property -> navigate to tracking info section -> click on Tracking code and copy the tracking code.
- Sign in to your Ghost admin dashboard from
- Go to Settings -> Code Injection.
- Paste the tracking code in the header section of code injection.
Adding analytics code to theme files
- Login to the Google analytics account and obtain the tracking code.
- Login to Ghost admin dashboard.
- Go to Settings -> Design and download the active theme.
- Extract the file and open
default.hbsin a text editor.
- Add tracking code between the
<head> </head>tags and zip the theme.
- Click on Upload a theme button in the same page (Design) of your admin dashboard and upload the zip.
- Click activate.
This is how we can integrate Analytics tracking code in Ghost.