Quickstart

Get Apex running on your site in under 5 minutes.

Use your coding agent

Install Apex in your editor and tell your agent to set it up. It sets up your workspace, installs the snippet or SDK, wires your events, and checks each one against Apex. See every step.

Using Claude Code? Run this in your terminal

claude mcp add --scope user --env APEX_URL=https://app.apex.inc apex -- npx -y -p @apex-inc/mcp-server@latest mcp-server

Then tell your agent

Set up Apex in this repo.

The first time your agent calls Apex, it gives you a link to approve in the browser. There is no key to paste. In Cursor you can also run /setup-apex.

Rather do it by hand? The steps below are the same setup.

Prerequisites

  • A website where you can add a script tag
  • An Apex account (sign up free)

Step 1: Install the tracking snippet

Add these two lines to your site's <head>. Replace YOUR_WORKSPACE_KEY with the workspace key from the dashboard.

<script src="https://app.apex.inc/api/apex-js?key=YOUR_WORKSPACE_KEY" async></script>

See Installation for the full reference, including the optional style that hides the page while visual experiments apply.

The snippet automatically captures:

  • Page views with full UTM parameter tracking
  • Form submissions with hidden field enrichment
  • Click IDs from Google, Meta, LinkedIn, and Microsoft ads

Step 2: Confirm it is live

Open your site and check the Network tab in DevTools. You should see requests to /api/apex-js, /api/events, and /api/experiments/active.

In Apex, open Set up Apex → Web Measurement. Apex waits for your site to say hello. You can also click Verify and enter your site URL. On Integrations, the Website card reads Heartbeats received once events are flowing.

For iOS Safari users, set up a first-party snippet domain so visitor cookies are not capped at 7 days.

Step 3: Identify a customer after they sign in

Anonymous page views are not enough to send a letter or measure a person. After login, call identify with their stable customer id. Put email on the traits, not as the id.

apex.identify(user.id, {
  email: user.email,
  first_name: user.firstName,
});

See Identity and Connect your customers if sign-in lives in Cognito, Auth0, Firebase, or Supabase.

Step 4: Define a conversion

A conversion tells Apex what success looks like. The fastest path is Set up Apex → Web Measurement → Define what counts as a conversion, which asks for the type and the one detail it needs to match:

  • Form submission — any form submit on your site. No extra detail needed.
  • Page visit — the path that means success, like /thank-you.
  • Click — a CSS selector for the element to watch, like a.signup-button.
  • Custom event — the exact event name you pass to apex.track().

That detail is not optional. A click conversion with no selector attaches no click handler, so it reports zero forever with nothing to explain why.

To edit conversions later, or to map them to your ad platforms, go to Settings → Conversions.

Step 5: Create your first experiment

  1. Go to Experiments and click New Experiment.
  2. Pick how the change reaches a visitor:
    • Apex changes the page — click elements on your site. No deploy. Only what is already on the page.
    • Your code changes the page — you call useApexVariant and deploy.
    • Your mobile app
    • An email, push, or in-app message
    • A step inside a journey
  3. Write your hypothesis. Apex mints a belief, a hypothesis, and a prediction from it, so the result updates your belief graph when the experiment concludes.
  4. Set your conversion as the success metric.
  5. Activate the experiment.

Apex handles variant assignment, result tracking, and statistical analysis.

Next steps