Using Google Analytics with Ghost

Google Analytics provides detailed statistics about visitor traffic to your site. To use it with Ghost, you need a Google Analytics account and a unique Tracking ID.

Setting Up Google Analytics

  1. Sign up for a Google Analytics account at Google Analytics.

  2. Obtain the Tracking ID for your site.

Editing the Theme

Some Ghost themes support Google Analytics by default. If your theme does not, follow these steps:

  1. Log in to Google Analytics, click Admin → Tracking Info → Tracking Code, and copy the entire tracking code, including <script> and </script> tags.

  2. Using SSH, navigate to installation_directory/content/themes/theme_name, where installation_directory is your Ghost installation folder and theme_name is your active theme.

  3. Open the default.hbs file with a text editor.

  4. Paste the Google Analytics code just before the closing </head> tag.

Important
Include both the starting <script> tag and the ending </script> tag.
  1. Save the default.hbs file.

  2. Restart Ghost. Google Analytics is now enabled.

Note
It may take up to 24 hours for Google Analytics to change from Tracking Not Installed to Receiving Data.

More Information

For further details, visit Google Analytics.

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution