Add FounderHQ to Ghost
Install the FounderHQ web SDK on a Ghost site with code injection.
Add FounderHQ to every page of your Ghost site, without touching the theme. About 2 minutes.
Before you start
You need a FounderHQ account and a publishable key. In the app, open Sequences → Settings → Event API keys, create a key for Browser/mobile, and copy it. The full key is shown only once. You also need admin access to your Ghost site.
Open Code injection in the Ghost admin
In the Ghost admin, open Code injection. It holds two fields: one is added to the head of every page, the other to the foot.
Paste the snippet into the site header field
Use the header field, the one that applies to the whole site. Replace
fhq_pk_XXXX with your key.
<script src="https://i.getfounderhq.com/events.js"></script>
<script>
founderhq.init("fhq_pk_XXXX");
</script>Save the change. Ghost applies it to every page at once: the home page, every post, every tag page, and every static page.
Do not paste it into a single post's code injection. That measures one post only.
Skip identify on a blog
A blog has no sign-in, so there is nobody to identify. FounderHQ still ties each visitor's pageviews to one anonymous contact, and links that history to a person later, when they sign up in your product.
Run paid memberships, and does your theme know the signed-in member's id?
Then you can call founderhq.identify with that id. Otherwise leave it
out.
Capture your own events, if you want them
Add a click handler in the same code injection field for a fact you care about.
<script>
document.querySelector("#subscribe")?.addEventListener("click", () => {
founderhq.capture("newsletter.subscribe_clicked");
});
</script>Use lowercase names you will still understand in six months. Event names
that start with $ are reserved.
Verify
- Open your site in a private window and read a post.
- In FounderHQ, open Sequences → Events.
- You see a
$pageviewfor that post, with the channel that brought the visitor. - Open a second post. A second
$pageviewarrives.
Events can take a few seconds to appear. The SDK batches them.
Troubleshoot
Nothing appears in Events
Open your browser console on the live site. If you see no request to
/i/v2/e, the snippet is not on the page. Confirm you saved the site-wide
header field, not a single post's field.
Requests to /i/v2/e return 401 or 403
The key is wrong, or your Ghost domain is not allowed. Check Allowed origins on the key in Sequences → Settings → Event API keys.
Your pageviews look low
FounderHQ keeps crawler visits out of your numbers, and search engines crawl a blog hard. See Bot traffic policy.