# Install on Ghost

> Add Reveata to a Ghost site with code injection, serve it from your own subdomain, and credit paid memberships to their visits.

Ghost adds code to every page with **Code injection**, on Ghost(Pro) and on self-hosted Ghost.

Copy the snippet from your Reveata dashboard (it contains your website’s tracking id):

```html
<script
  defer
  data-website-id="ws_your_tracking_id"
  src="https://reveata.com/js/script.js"
></script>
```

## Add it to your site

1. In Ghost Admin, open **Settings** (the gear icon), then **Advanced → Code injection**, and select **Open**.
2. Paste the snippet into **Site header**.
3. Select **Save**. It runs on every page of your site straight away, with no theme change.

Ghost pages are full page loads, so every page is counted. Add the website in Reveata with the address of your site; a `.ghost.io` address is another host than your custom domain.

## Serve it from your own subdomain

On Ghost(Pro), use the [managed proxy](https://reveata.com/docs/managed-proxy): add one DNS record (for example `stats.example.com`) where your domain’s DNS is managed, then replace the snippet in **Site header** with the new one Reveata gives you.

Self-hosted Ghost usually runs behind NGINX or Caddy, which can proxy the script and events for you: see [Install with NGINX](https://reveata.com/docs/nginx#proxy-through-nginx) or [Install with Caddy](https://reveata.com/docs/caddy#proxy-through-caddy).

## Revenue

Ghost charges paid memberships through the Stripe account you connected in **Settings → Membership**. Connect the same Stripe account in Reveata, and identify signed-in members in your theme, so each membership is credited to the visit that brought the member. The full steps, with the theme code, are in [Revenue from Ghost](https://reveata.com/docs/revenue-ghost).

## Check it works

1. Open your site in a normal browser window with ad blockers turned off for it.
2. Open **Realtime** in Reveata: your visit appears within a few seconds.
3. If nothing arrives, follow [Verify your installation](https://reveata.com/docs/verify-your-installation).

## Goals

Count new members with a goal that needs no code: in Reveata, open **Goals → Add goals → Page visit, no code**, and use a page only new members see. To count clicks, add `data-reveata-goal="subscribe"` to a link or button in an HTML card or in your theme. See [Custom goals](https://reveata.com/docs/custom-goals).

## Common pitfalls

- **Theme helpers in code injection.** `{{@member.email}}` and other theme helpers don’t work in code injection; put member code in the theme, as [Revenue from Ghost](https://reveata.com/docs/revenue-ghost) shows.
- **A shared Stripe account.** If the Stripe account connected to Ghost is also used for other sales, Reveata imports those too. Ghost recommends a Stripe account of its own.
- **Ghost’s own analytics** run alongside Reveata without conflict; there’s nothing to turn off.
