Docs menuInstall CentPath › Install the script
Add CentPath to Ghost
On this page
Add CentPath to your Ghost site with code injection, so every page of your site counts its visits.
1. Copy your snippet
In CentPath, open your site, go to Setup → Install and click Copy. The snippet you copy holds your site's own id, so every visit counts for the right site:
<script>window.analytics = window.analytics || Object.assign([], { q: [], goal: function () { this.q.push(arguments); } });</script>
<script defer src="https://centpath.app/script/p.js" data-site-id="YOUR_SITE_ID"></script>2. Open code injection
- In Ghost Admin, open Settings.
- Find Code injection, in the Advanced section, and open it.
3. Paste it into the site header
- Paste the snippet into Site header. Ghost adds it to the
<head>of every page, so you paste it once. - Click Save.
Verify the setup
- Open your site in a private window and load a page.
- In CentPath, look under the steps in Setup → Install: Waiting for your first pageview… turns into First pageview received. once the visit arrives.
- If it said First pageview received. before you started, your site has had visits already: look for this one in your dashboard instead. Reload it, and the visit shows in the Visits feed, usually within a minute.
Check your installation shows more ways to check a page.
Troubleshooting
No visits arrive
- Check that you clicked Save, and that the snippet is in Site header.
- Open your site's source in your browser and search for your site's id. If it isn't there, your theme may not add Ghost's code injection to its pages: try one of Ghost's own themes to check.
Goals sent early in a page are lost
The snippet is in Site footer, whose code loads at the end of each page, after your page's own scripts. Move it to Site header, so goals your page sends early wait for the script.