Skip to main content
This guide walks you through integrating the Tappd Web SDK from scratch. By the end, you’ll have session tracking, user identification, custom event tracking, and page view recording running in your application.
1

Get your App ID

Every SDK call is tied to a Tappd app. Before you write any code, grab the App ID for the application you want to instrument.
  1. Log in to your Tappd Dashboard.
  2. Navigate to Settings → Apps.
  3. Create a new app or select an existing one.
  4. Copy the App ID — it looks like a1b2c3d4-e5f6-7890-abcd-ef1234567890.
Store your App ID in an environment variable (e.g. VITE_TAPPD_APP_ID or REACT_APP_TAPPD_APP_ID) rather than hard-coding it in source files. This makes it easy to use different IDs across dev, staging, and production.
2

Install the SDK

Choose the installation method that matches your project setup.
The CDN build exposes the SDK as TappdSDK.TappdSDK on the global window object. The NPM build uses named exports, so you import TappdSDK directly.
3

Initialize the SDK

Call new TappdSDK(config) once when your application loads — not on every page render. Initializing the SDK starts a session and, if autoTrack is enabled, records the first page view immediately.
Replace YOUR_APP_ID with the ID you copied from the dashboard.
4

Identify users

Call tappd.identify() as soon as you know who the current user is — typically after login or signup. The SDK automatically merges any anonymous activity recorded before identification with the user’s profile.
The external_id field is your application’s user identifier (for example, a UUID or any unique, stable ID from your system). The SDK generates and manages its own session-level identifier automatically — you don’t need to create or pass one.
5

Track events

Use tappd.track() to record any meaningful action in your application. Pass an event name and an optional properties object.
Event names can be any string. Use consistent naming across your app — for example, snake_case — so your analytics data stays clean and queryable.
6

Track page views manually (optional)

When autoTrack is enabled (the default), the SDK records page views for you automatically, including client-side navigation in SPAs. If you disable autoTrack or need to record a page view at a specific moment, call tappd.trackPageView() directly.
Use trackPageView in frameworks where you control routing manually — for example, inside a route-change handler — to ensure every navigation is captured with the context you need.

Framework-specific setup

The SDK is framework-agnostic, but each framework has its own lifecycle conventions. Use the tab for your stack to see the recommended initialization pattern.
Initialize the SDK inside a useEffect with an empty dependency array so it runs once after the component mounts. Store the instance on window (or in a React Context) so other components can access it without re-initializing.

Verify your installation

Enable debug: true during development to confirm the SDK initialized correctly. Open your browser’s developer console and look for log output like the following:
Once you see these messages, the SDK is working correctly. Switch debug back to false before deploying to production.

Next steps

Configuration Reference

Fine-tune session timeouts, message polling, auto-capture, and more.

API Reference

Explore every method available on the TappdSDK instance.

In-App Messages

Display banners, popups, and modals triggered by user behavior.

Examples

Browse real-world code samples for common use cases.