Skip to content

Events API

Send a pageview or custom event from a trusted server to Supermetry.

Send a server-side event through the same intake endpoint used by the browser tracker.

  1. Set the instance URL and the site’s public ID.

    Terminal window
    export SUPERMETRY_URL="https://analytics.example.com"
    export SUPERMETRY_SITE="my-site"
  2. Submit a custom event.

    Terminal window
    curl --fail-with-body -X POST "$SUPERMETRY_URL/api/public/v1/events" \
    -H "Content-Type: application/json" \
    -H "User-Agent: Mozilla/5.0" \
    --data "{\"site\":\"$SUPERMETRY_SITE\",\"name\":\"Signup\",\"url\":\"https://www.example.com/signup\",\"props\":{\"plan\":\"pro\"}}"
  3. When sending on behalf of a visitor, forward the original User-Agent. Forward X-Forwarded-For only through a proxy included in SUPERMETRY_TRUSTED_PROXIES; Supermetry uses these values for session and device processing but does not store them.

  4. Do not add an API key. Event intake is public, but allowed hosts, exclusion rules, bot filtering and rate limits still apply.

What you should see: an empty response with HTTP status 202 Accepted; the custom event then appears in the site’s events view.