Intempt Docs
GuidesGetting Started

Complete guide to event tracking

A step-by-step walkthrough of Intempt event tracking: installing autocapture, sending custom events with the SDK, verifying data, and turning raw events into named events.

Overview

Event tracking is how Intempt learns what your customers are doing on your website or in your app. This guide walks through the full path: install the SDK for autocapture, add custom events for anything autocapture can't see on its own, verify the data is flowing, and turn raw events into named events you can reuse across the platform.

Setting up autocapture

Autocapture gets you page views, clicks, form activity, and sessions from a single JavaScript snippet. It doesn't require defining individual events, and it keeps working after you change your frontend, since it isn't wired to specific elements you named ahead of time.

To set it up:

  1. Go to Integrations, and stay on the Connections tab (this is the default view).

  1. Under Sources, click JavaScript.

  1. Name the connection, then copy the installation snippet shown in the dialog.

  1. Paste the snippet into your site's <head>, ideally on a shared template every page loads. Replace {YOUR_API_KEY} in the second <script> tag with your project's API key; your organization, project, and source values are already filled in.

📘 Good to know

The snippet ships two <script> tags: a small queue stub that lets window.intempt.* calls work immediately, and the SDK itself, loaded asynchronously. Both are required, and the queue stub must come first.

Once the snippet is live, autocapture starts recording page views, page exits, sessions, clicks, form field changes, and form submissions, no further setup needed. See JavaScript SDK: Auto-Tracking for the full list and for how to mask sensitive on-screen text with doNotCapture.

Autocapture's limits

Autocapture is a general-purpose net. It's not enough on its own for two reasons.

First, it can be noisy. Every click, field change, and submission gets tracked, so on a busy site the raw event volume can bury the handful of actions you actually care about.

Second, it only tells you that something happened on a page, not what it meant to your business. To track a specific outcome, like a completed purchase or a plan upgrade, you send a custom event yourself.

Sending custom events

Custom events let you capture exactly what you care about, from anywhere in your codebase: a button press on the frontend, a webhook handler, or a backend function call.

The JavaScript SDK exposes two methods for this: track() for a bare event plus data, and record() when you also want to attach a user or account to it in the same call. Both take a single object argument.

intempt.track({
  eventTitle: 'Purchase completed',
  data: {
    orderId: 'order_123',
    amount: 99.99,
    currency: 'USD'
  }
});
intempt.record({
  eventTitle: 'Signed up',
  userId: 'john.doe@example.com',
  data: {
    plan: 'pro',
    referrer: 'google'
  }
});

📘 Good to know

This guide only shows the shape of track() and record(). For the full parameter tables, required fields, and every other SDK method (identify, alias, group, consent, product tracking, DOM events), see the JavaScript SDK reference.

Using event listeners

To fire a custom event when someone interacts with a specific element, attach an event listener to it and call track() or record() from inside the handler.

<button id="signupBtn">Sign up</button>
document.getElementById('signupBtn').addEventListener('click', () => {
  intempt.record({
    eventTitle: 'Signed up',
    data: {
      first_name: document.getElementById('first_name_input').value,
      last_name: document.getElementById('last_name_input').value,
      email: document.getElementById('email_input').value
    }
  });
});

🚧 Don't miss out!

Use a unique id on every element you attach a listener to. Reusing an ID means only the first matching element on the page gets the listener.

Identifying users

Autocaptured events identify anonymous visitors automatically. Custom events need you to identify the user yourself, so Intempt can connect their prior anonymous activity to a known identity.

intempt.identify({ userId: 'john.doe@example.com' });

Group event tracking

Some events belong to a company or account rather than a single user. Use group() to aggregate events at that level instead of, or in addition to, the individual user.

intempt.group({
  accountId: 'company_abc',
  eventTitle: 'Account Updated',
  accountAttributes: {
    name: 'Acme Corp',
    plan: 'enterprise'
  }
});

This is useful for metrics like the number of organizations that signed up, rather than the number of individuals.

Verifying event tracking

There are three ways to confirm your events are arriving.

Browser network tab

Open your browser's dev tools, select the Network tab, and filter for tracking requests. Click a request to inspect its payload and confirm it carries the data you expect.

User profile activity timeline

Open a user's profile and switch to the Activity tab. It shows a chronological timeline of every event that user triggered, grouped by day, with a details panel showing the attributes of whichever event you select.

Events Live tab

Open Events, then switch to the Live tab for a real-time, streaming view of every event as it arrives. This is the fastest way to confirm an event is flowing before you go looking for it anywhere else. See Live data feed for filtering, pausing, and column options.

Combining events into named events

A single user action rarely maps to one raw event. A signup, for example, might involve a page view, several form field changes, and a submission. Rather than filtering on those raw signals every time, you can define a named event once, from the Events page, and reuse it in segments, journeys, and personalization.

See Creating an event for the full walkthrough, and Event types for how autocaptured, custom, and named events differ.

Where to go next

On this page