Documentation
Getting started

Quickstart: Web (snippet)

Add FounderHQ to any website with one script tag.

Add two script tags and see your first event in FounderHQ. About 5 minutes.

Before you start

You need a FounderHQ account and a publishable key. In the app, open Analytics → Settings → Events SDK, create a key for Browser or mobile, and copy it. The full key is shown only once.

Nothing is sent anywhere. A publishable key is saved in this browser. A secret key is kept only until you reload.

Use this page when you can edit your site's HTML. If you build with npm, use Quickstart: Web (npm) instead.

Load the SDK

Paste this into your <head>, on every page you want to measure.

<script src="https://i.getfounderhq.com/events.js"></script>
<script>
  founderhq.init("fhq_pk_XXXX");
</script>

The script defines a global called founderhq. It also defines FounderHQEvents, and FounderHQEvents.founderhq is the same object.

From here on, page views, page leaves, sessions, clicks, rage clicks, dead clicks, outbound clicks, scroll depth, and Core Web Vitals are captured for you.

FounderHQ records everything from the first page view. If your site asks visitors for consent first, start in the pending state and call consent when the visitor accepts:

<script>
  founderhq.init("fhq_pk_XXXX", { consent_default: "pending" });
  // Later, when the visitor accepts your banner:
  founderhq.consent("granted");
</script>

While consent is pending, FounderHQ counts page views without cookies and records nothing else: identify and your own events are ignored. FounderHQ remembers the visitor's answer for 180 days. See Consent and privacy.

Identify the person when they sign in

Call identify with your own user ID after a sign-in or sign-up.

<script>
  founderhq.identify("user_8421", {
    email: "jane@acme.com",
    plan: "pro",
  });
</script>

FounderHQ merges the visitor's anonymous history into that contact.

Capture your first event

Capture a fact that matters to your business.

<script>
  founderhq.capture("trial.started", { plan: "pro" });
</script>

Use lowercase names you will still understand in six months. Event names that start with $ are reserved.

Verify

  1. Load a page on your site and click the button that fires the event.
  2. In FounderHQ, open Analytics → Events & Visits.
  3. You see trial.started with plan: pro, plus a $pageview for the page you loaded.
  4. Open Analytics → People. Jane is there with her email.

Events can take a few seconds to appear. The SDK batches them.

Troubleshoot

Nothing appears in Events

Open your browser console. If requests to /i/v2/e fail with a 401 or 403, the key is wrong or your site's origin is not allowed. Check the key you pasted, and check Allowed browser origins on the key in Analytics → Settings → Events SDK.

You see page views but not your event

Your site starts with consent_default: "pending" or "denied", and the visitor has not accepted yet. FounderHQ then records page views only. Check that founderhq.consent("granted") runs when they accept your banner.

The person shows as a guest

identify must run after the person signs in, with a stable ID from your database. Do not pass an email as the ID. See Identity and contacts.

You see no bot traffic

That is deliberate. FounderHQ keeps crawler visits out of your metrics and your bill. See Bot traffic policy.

AI agent or LLM? Read this page as markdown

On this page