RenderContextDocumentation

Quickstart

Install the browser SDK, add your domain, and confirm your first pageview in the console. The script works with any framework.

1. Create a project

Sign in to the console with Google and create an organization and project. Copy the public key from the environment you want to deploy to — it starts with pk_live_.

2. Add allowed domains

In project settings, add every hostname where the script will run (for example example.com or www.example.com). This step is optional but recommended — if you leave it blank, your project accepts events from any origin until you add domains.

For local development, add localhost and include the data-allow-localhost attribute on the script tag (see below).

3. Choose your setup

Choose your framework. The setup stays here so you can copy it, set your key, and move straight to verification.

Install the Vite plugin and place it before the plugin for your framework.

pnpm add -D @rendercontext/sdk vite

// vite.config.ts
import { defineConfig } from "vite";
import { renderContext } from "@rendercontext/sdk/vite";

export default defineConfig({
  plugins: [
    renderContext({ projectKey: import.meta.env.VITE_ANALYTICS_PROJECT_KEY }),
    // Your framework plugin goes here.
  ],
});

Set VITE_ANALYTICS_PROJECT_KEY to the public key for this deployment.

4. Confirm your first pageview

Deploy or open your site on an allowed domain. Pageviews are recorded automatically after the SDK fetches a render context from the edge. Open the project overview in the console — you should see your first event within a few seconds.

Page reports group dynamic URL segments automatically (for example /users/abc-123 appears as /users/:id). You can tune this in project settings under Path ID detection.

If nothing appears, check that the domain matches your allowed-domain list exactly and that the public key is correct. Events are not sent until render context succeeds.

5. Track custom events

Use renderContext.event for actions beyond pageviews.

renderContext.event("signup_completed");

Events are batched and sent automatically. Call await renderContext.flush() to send immediately.

Next steps

  • Environments — verify changes with a development or staging key first.
  • Feature flags — roll out features to a percentage of visitors.
  • Experiments — run A/B tests with conversion goals.
Back to docs