SDK reference

The tigr SDK API

One API across Vue, React, and React Native. Grab the client, then call any of the methods below. New here? Start with the install guide.

Get the tigr client: the tigr global in React / React Native, or useTigr() in Vue / Nuxt. The methods below are identical.

component
// React / React Native — the global, no hook
import { tigr } from 'tigr-react'

// Vue / Nuxt — the composable
const tigr = useTigr()
API

Methods

  • track(name, properties?)

    Record a custom event with optional properties. This is how you track anything beyond the auto captured signals.

    Example
    tigr.track('upgrade_pressed', { plan: 'pro' })
  • identify(userId, traits?)

    Link the current anonymous visitor to a real user, call it on login. Traits (name, email, plan…) build the user's profile.

    Example
    tigr.identify('user_123', { email: 'jane@acme.com' })
  • setUser(userId, traits?)

    A friendlier alias for identify, both do exactly the same thing. Use whichever name you prefer.

    Example
    tigr.setUser(user.id, { name: user.name })
  • reset()

    Forget the logged in user and start a fresh session. Call it on logout.

    Example
    tigr.reset()
  • flush()

    Send any queued events to the backend immediately, instead of waiting for the next batch.

    Example
    tigr.flush()
Configuration

Config options

Passed when the SDK is initialized. Shared across every framework.

OptionTypeDefaultDescription
apiKeystringrequiredProject API key. Determines which project receives the data.
autoCaptureboolean | objecttruetrue / false, or per signal, switch individual auto capture signals on or off.
flushIntervalnumber2000How many ms after the first queued event a batch is sent.
batchSizenumber20Send immediately when the queue reaches this size.
debugbooleanfalseLogs every event and flush to the console.
devModebooleanfalseWhen true the SDK does nothing, turn it on in development so your own activity doesn't pollute your analytics.
Auto captured events

Events you get for free

The SDK emits these on its own. Everything else you send with track('event_name', { ...props }).

Web (Vue, React)

  • pageview

    Every page view, including SPA route changes.

  • session_start

    When a new session starts (renews after 30 min of inactivity).

  • rage_click

    3+ rapid clicks in the same spot, frustration or a broken button.

  • scroll_depth

    When the user reaches the bottom of the page.

  • error

    Uncaught JS errors and promise rejections.

  • page_leave

    When the user leaves the page or tab.

React Native

  • session_start

    When a new session starts (renews after 30 min of inactivity).

  • app_background

    When the app goes to the background, forces a flush.

  • error

    Uncaught JS errors via the global handler.