Thisbefine
Getting Started

Installation

Get the SDK installed in your project

Installation

Prerequisites

  • Node.js 18+
  • React 18+ for hooks
  • Thisbefine account with API key

Install

pnpm add @thisbefine/analytics
npm install @thisbefine/analytics
yarn add @thisbefine/analytics
bun add @thisbefine/analytics

Entry Points

Entry PointUse Case
@thisbefine/analyticsCore SDK, works anywhere
@thisbefine/analytics/reactReact hooks
@thisbefine/analytics/nextNext.js with automatic pageviews

Get Your API Key

Create a Workspace

Each workspace has its own API key and data.

Copy Your API Key

Go to Settings → API Keys. Keys start with tif_.

Environment Variables

.env.local
NEXT_PUBLIC_THISBEFINE_API_KEY=tif_your_api_key_here

Next.js requires the NEXT_PUBLIC_ prefix to expose variables to the browser.

TypeScript

Types included. No @types package needed.

import type { AnalyticsConfig, UserTraits, AccountTraits } from '@thisbefine/analytics';

Browser Support

Chrome 80+, Firefox 78+, Safari 14+, Edge 80+. No IE.

Bundle Size

PackageSize (gzipped)
Core~3KB
React~1KB

Next Steps

On this page