# Add CentPath to Ghost

> Paste the snippet into the Site header of Ghost's code injection, once for every 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:

```html
<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

1. In Ghost Admin, open **Settings**.
2. Find **Code injection**, in the **Advanced** section, and open it.

## 3. Paste it into the site header

1. Paste the snippet into **Site header**. Ghost adds it to the `<head>` of every page, so you paste it once.
2. Click **Save**.

## Verify the setup

1. Open your site in a private window and load a page.
2. In CentPath, look under the steps in **Setup** → **Install**: **Waiting for your first pageview…** turns into **First pageview received.** once the visit arrives.
3. 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](https://centpath.app/docs/verify-installation) shows more ways to check a page.

## Troubleshooting

### No visits arrive

1. Check that you clicked **Save**, and that the snippet is in **Site header**.
2. 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.
