Skip to content

Canopus measurement

One script tag on your site and one endpoint for your server. Together they fill visitors by source, active users, sign-ups, activation, retention and the signals that say where people get stuck, without a cookie and without anything stored in the visitor’s browser. PostHog becomes optional. If you code with an assistant, the setup with an assistant page gives the prompt that does this for you.

Install the snippet

Three steps, and the third one only to check that it works.

  1. Copy your site key

    Settings, then Connectors: the card Canopus measurement shows the snippet with your site key (it starts with cs_) already in it. The key is public by design: it sits in your HTML. It reads nothing, but anyone who copies it can send events to your measurement, the way any public analytics key can; the limits below bound what they can send.

  2. Paste it in the head of every page

    Once, in your layout, so every page carries it. It loads with defer and never blocks rendering. Single-page apps need nothing more: a change of path is counted as a new page. If your public site and your signed-in product are the same app, load the script only for visitors who are not signed in: the snippet has no identify() call, so otherwise every customer who opens the product counts as a visitor, every day.

  3. Watch the card change state

    The card goes from not installed to waiting for a first visit, then to receiving data. The figures are computed once a day, so the charts fill from the next computation. They are all read on the Measurement screen, under Customers: visitors and sources, funnel, pages people leave, slow pages, errors, friction and monthly retention.

<script defer src="https://www.canopushq.io/canopus.js" data-site="cs_..."></script>

Named events from the page

The snippet defines window.canopus. Call it with a name and, if you want, flat properties, for anything a visitor does on the page that matters to growth: starting a sign-up, opening the pricing toggle, submitting a form. Those names become available as funnel steps and as A/B test goals.

// Anywhere after the snippet: a name, then flat properties.
window.canopus('signup_started', { plan: 'pro' })
window.canopus('pricing_toggle', { period: 'yearly' })
  • A name starts with a letter and uses letters, digits and _ . : - (80 characters at most).
  • Properties are flat: strings, numbers or booleans, twenty at most, keys cut at 40 characters and strings at 200.
  • Reserved names, used by the snippet itself, are ignored when you pass them to window.canopus(), and refused by the server endpoint: pageview, rage_click, dead_click, web_vitals, js_error, experiment_exposure.
  • An event sent from the page names a visit, not a person. What a signed-in user does in your product belongs to the server endpoint below.

What is measured

Everything below is collected by the snippet with no code from you beyond the tag.

  • One page view per page, with the path (segments that look like an address, an id or a token replaced), the referring host when it is another site, and utm_source, utm_medium and utm_campaign.
  • Rage clicks: three clicks within 700 milliseconds in the same spot.
  • Dead clicks: a clickable element that changes nothing within a second (neither the page, nor the address, nor the scroll).
  • Web Vitals: LCP, INP, CLS and FCP, sent once when the page is left.
  • Browser errors, five per page at most, their message only.
  • The A/B tests you started: which version the visitor saw.

What is never stored

  • No cookie, no local storage, no fingerprint: the browser keeps nothing.
  • Not the IP address, not the user agent, not the query string of the page.
  • Not the text of a clicked element: it is described by its tag, its id or its first class.
  • Not the raw error message: addresses, URLs, long identifiers and numbers are replaced, and the message is cut at 200 characters.
  • Not the email you pass with a server event: it only links the event to a contact already in your CRM.

Privacy, consent and retention

The visitor is a hash Canopus computes on its side from a random salt of the day, your site key, the address and the browser, truncated. The salt is deleted two days later; from then on nobody, Canopus included, can tell which address a hash came from. The same person on two different days is two visitors: there is no identity across days, and the snippet has no identify() call to tie a visitor to one of your users.

That design is the one the CNIL describes for audience measurement exempt from consent, so the measurement adds no consent banner to your site. A browser that sends Do Not Track or Global Privacy Control sends nothing, and the collector ignores it anyway. Bots are left out.

Raw events are kept thirteen months, then deleted. The daily figures computed from them stay in your history.

POST /api/v1/events

What people do in your product, sent by your server. Authenticate with an API key that carries the events:write permission (Settings, then API). Up to 100 events per call and 256 KB per body. The answer is a 202 that counts what was stored, what was a duplicate and what was rejected.

These events are usage, not lifecycle: they count active users, sign-ups and activation, and they change nobody in your CRM. They create no contact and send no email. Who a person is, and when they pay or leave, keeps going through the signed CRM webhook.

event *
The name, with the same rules as on the page. Reserved names are refused.
userId *
Your own user id. An event nobody did is not usage.
email
Links the event to a contact already in your CRM. Never stored, never creates a contact.
timestamp
ISO 8601 with an offset. At most seven days old and five minutes ahead; outside that window the event is rejected, not the batch.
properties
Flat: strings, numbers or booleans, twenty at most.
eventId
Your id for the event. A batch replayed with the same ids is not counted twice.
curl -X POST https://www.canopushq.io/api/v1/events \
  -H "Authorization: Bearer $CANOPUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "event": "project_created",
        "userId": "usr_123",
        "timestamp": "2026-11-21T09:30:00Z",
        "properties": { "template": "blank", "seats": 3 },
        "eventId": "evt_project_created_8812"
      },
      {
        "event": "invoice_sent",
        "userId": "usr_123",
        "email": "ada@customer.example"
      }
    ]
  }'
{
  "stored": 2,
  "duplicates": 0,
  "rejected": []
}

Errors

The same shape as the rest of the API: {"error": {"code", "message"}}. Branch on the code, never on the message. An event outside the timestamp window does not fail the batch: it comes back in rejected with its index and the reason timestamp_out_of_range.

CodeStatusWhat it means, and what to do
unauthorized401The key is missing, malformed or revoked. The response never says which.
insufficient_scope403The key is valid but lacks the events:write permission. Create a key with it on the API screen.
subscription_required402No active subscription covers this project, so nothing was stored. Choosing a plan, or putting the project back under yours, starts it again.
payload_too_large413The request body passed 256 KB.
invalid_payload422The body is not JSON or does not match the contract (a reserved name, a missing userId, more than 100 events). `details` names each field.
rate_limited429Too many requests for this key or this address. `Retry-After` says when to come back.
internal_error500Our side failed and nothing was stored. Retry with the same eventId values: the retry cannot count an event twice.

Rate limits

  • 120 requests per minute per key, and 120 per minute per address, on the server endpoint.
  • A 429 carries Retry-After in seconds. Batch your events rather than sending one per request.
  • The snippet has its own limits: 600 requests a minute per visitor address (an office or a mobile network puts many readers behind one), 300 a minute for the A/B configuration, and 3,000 a minute per site. A refusal there never reaches the visitor.

Already on the CRM webhook

If your product already calls the CRM webhook, you have sign-ups and activation without a second integration. While Canopus measurement is active, user.created, user.trial_started and user.activity are copied into your product events under the user’s external id, deduplicated by the webhook’s event id.

The rest of the lifecycle (payments, churn, limits) is billing rather than usage and is not counted as an event. A copy that fails never fails the webhook.

Choose sign-up, activation and the funnel

On the Canopus measurement card, three choices tell the daily computation what your events mean. They are picked among the events Canopus has actually received, so a typo cannot become a funnel step.

  • The sign-up event: a person signs up at their first occurrence of it.
  • The activation event: a person is activated by it, or, without one, by activity on a later day than their sign-up, within thirty days.
  • Up to four funnel steps, in order. Each step is counted on its own over 30 days, and the gap from one to the next becomes a signal; a step sent by the page counts visitors of a day, a step sent by your server counts people, so prefer steps from the same side. The acquisition that converts is computed when the last step is an event sent by the page.

Switching from PostHog

One source at a time. While PostHog is connected it stays the source of your product numbers, and Canopus measurement does not compute them: two sources on one chart would make the line jump depending on which ran last. The card says so.

To switch, install the snippet and the server call, let the events arrive, then disconnect PostHog on the Connectors screen. Canopus measurement takes over from the next daily computation, and the history already collected stays. Session replay and heatmaps are not part of Canopus measurement: keep PostHog for them if you need them.

A/B tests, from the snippet’s side

A test you start in Campaigns, then A/B tests, needs nothing more on your site: the snippet already carries it. On every page it asks Canopus which tests are running there and which version this visitor sees today, then replaces the text of the element you chose.

  • The assignment is made on Canopus’s side from the visitor’s daily hash: no cookie, the same version on every page of the day as long as the visitor keeps the same browser and connection, and two tests are independent.
  • The first element matching your CSS selector changes only if its content is a single run of text, such as a heading or a button label: that text is replaced, never the HTML, so icons and the nodes your framework manages stay untouched. An element with anything else inside is skipped, for both versions. The variant is plain text, 300 characters at most.
  • The swap happens once the script has loaded, so keep the snippet in the head to make it as early as possible.
  • Bots, browsers sending Do Not Track or Global Privacy Control, and projects without an active subscription see the page as it is.
  • The goal is a named event the page sends, or reaching another page, by the same visitor on the same day. The verdict waits for 100 visitors per version and asks for p below 0.05.