Stickybeak Docs Dashboard Get early access

Backends

Server-rendered sites

For any server-rendered site, put Stickybeak in the shared layout and pass one-time server events to the next page.

<script
  defer
  data-site="YOUR_SITE_ID"
  data-domain="example.com"
  src="https://app.usestickybeak.com/_cfw/s.js"
></script>

The pattern

  1. Keep production separate

    Read the site ID from config and set it only in production. The ID is public; the check keeps staging traffic out.

  2. Add the tag

    Render it before </head> in the layout every page shares.

  3. Queue browser goals

    Place this above calls that may run before the deferred script loads:

    <script>window.stickybeak = window.stickybeak || function () { (window.stickybeak.q = window.stickybeak.q || []).push(arguments); };</script>

Server-side goals and custom events

Goals (often called custom events or conversions) do not use a server-to-server event API in Stickybeak. Store the goal as a one-time session flash, redirect, then safely JSON-encode a browser call in the next page’s <head>:

<script>window.stickybeak("signup", { "plan": "pro" });</script>
Encode for JavaScript

Use your framework’s JSON or JavaScript encoder, not HTML escaping or raw user input.

If an event always ends on a unique thank-you path, create a page-visit goal under Manage goals instead. See Custom goals.

Revenue

Send revenue (or amount), currency and order_id from the confirmation page. Each order ID counts once.

<script>window.stickybeak("purchase", { "revenue": 49.5, "currency": "USD", "order_id": "1042" });</script>

See Revenue.

Common gotchas

  • localhost and iframe previews are not counted. Do Not Track and Global Privacy Control are.
  • Only the configured domain and its subdomains are accepted; keep subdomain staging behind the production check.
  • Never put a flashed goal into a publicly cached response.
  • A Content Security Policy must allow the external script, connections and any inline queue.

See Troubleshooting or Verify your install.

All backend guides