How to Add Google Analytics to Your Ghost Blog

If you've started a Ghost blog and want to track your website traffic, adding Google Analytics is a great way to gain insights into your audience. This guide will walk you through the steps to set up Google Analytics for your Ghost blog.

How to Add Google Analytics to Your Ghost Blog
Photo by Stephen Phillips - Hostreviews.co.uk / Unsplash

Step 1: Create a New Property in Google Analytics

  1. Log in to Google Analytics: Head over to Google Analytics and sign in with your Google account.
  2. Access the Admin Panel: Click on the Admin button located at the bottom-left corner of the interface.
  3. Create a New Property: In the Account column, select the account where you want to add the property. Then, in the Property column, click on the + Create Property button.
  4. Property Setup:
    • Property Name: Enter a name for your property (e.g., "Ghost Blog").
    • Reporting Time Zone: Choose your time zone.
    • Currency: Select your preferred currency.
  5. Business Information: Fill in the business details as required and click on the Create button.

Step 2: Get the Tracking Code

  1. Set Up Data Stream: After creating the property, you'll be directed to the Data Streams page. Click on Web to set up a new data stream.
  2. Enter Blog Details:
    • URL: Enter your blog's URL (e.g., "https://ghostblog.com").
    • Stream Name: Give it a name (e.g., "Ghost Blog Stream").
  3. Create Stream: Click on the Create Stream button. You'll receive a Measurement ID (which starts with G-).
  4. Global Site Tag (gtag.js): You'll see a piece of JavaScript code under the Tagging Instructions. This is your tracking code.

Step 3: Add the Tracking Code to Your Ghost Blog

  1. Log in to Ghost Admin: Go to your Ghost blog's admin panel (e.g., https://ghostblog.com/ghost).
  2. Navigate to Code Injection: In the admin panel, go to Settings > Code Injection.
  3. Paste the Tracking Code:
    • In the Site Header section, paste the Global Site Tag (gtag.js) code you copied from Google Analytics.
  4. Save Settings: Click on the Save button to apply the changes.

Step 4: Verify Tracking

  1. Check Google Analytics: Return to your Google Analytics account.
  2. Real-Time Report: Navigate to the Real-Time report to see if your website traffic is being tracked. You should see activity if you visit your blog while this report is open.

Conclusion

By following these steps, you can successfully add Google Analytics to your Ghost blog and start gaining valuable insights into your audience. If you encounter any issues or have any questions, feel free to leave a comment below.