Tapemetric

Getting started

Quickstart

From zero to your first event in under 5 minutes. Pick the platform you're shipping on.

1. Create a workspace and grab your API key

Sign up at tapemetric.com/signup. After signup, head to API keys → New key. Pick the environment (production, staging, or development) and copy the key — it’ll be shown only once.

API keys look like:

text
tm_live_a1b2c3d4e5f6...   # production
tm_test_a1b2c3d4e5f6...   # staging or development
Treat the production API key like a credential. Don’t commit it to git. On web you’ll inject it through your build pipeline; on mobile it gets bundled into the app binary, which is normal — Tapemetric keys are scoped to ingest only and can’t read data back.

2. Install the SDK

Pick your platform:

Web (JavaScript / TypeScript)

bash
npm install @tapemetric/analytics
# or
yarn add @tapemetric/analytics
# or
pnpm add @tapemetric/analytics

Or use the CDN build for plain HTML pages:

html
<style="color:#f472b6">script src="https://cdn.jsdelivr.net/npm/@tapemetric/analytics@1.0.0/dist/tapemetric.min.js"></style="color:#f472b6">script>

iOS / tvOS / macOS (Swift)

Swift Package Manager — in Xcode, File → Add Packages…:

text
https://github.com/tapemetric/analytics-ios.git

Or CocoaPods:

ruby
pod 'TapemetricAnalytics', '~> 1.0'

Android (Kotlin / Java)

bash
// In your app's build.gradle
implementation 'com.tapemetric:analytics:1.0.0'

3. Initialize

Web

app/analytics.ts
import Tapemetric from '@tapemetric/analytics';

export const tm = Tapemetric.init({
  apiKey: process.env.NEXT_PUBLIC_TAPEMETRIC_KEY!,
  debug: process.env.NODE_ENV !== 'production',
});

iOS

swift
import TapemetricAnalytics

// In AppDelegate.application(_:didFinishLaunchingWithOptions:) or App.init()
Tapemetric.configure(
    TapemetricConfig(apiKey: "tm_live_yourkey")
)

Android

kotlin
import com.tapemetric.analytics.Tapemetric
import com.tapemetric.analytics.TapemetricConfig

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Tapemetric.configure(this, TapemetricConfig(apiKey = "tm_live_yourkey"))
    }
}

4. Track your first event

Wire your player’s play event to trackPlayStart:

player.ts
import { tm } from './analytics';

videoElement.addEventListener('play', () => {
  tm.trackPlayStart({
    contentId: 'aashiqana_s04e12',
    contentType: 'series',
    contentTitle: 'Aashiqana',
    season: 4,
    episode: 12,
  });
});

videoElement.addEventListener('ended', () => {
  tm.trackComplete({ positionSec: videoElement.duration });
});

5. Verify it’s working

Open your Realtime dashboard at app.tapemetric.com/dashboard/realtime. You should see a concurrent viewer count tick up within 30 seconds of playback starting.

Not seeing data? Check the troubleshooting guide or look in your browser’s network tab — calls to ingest.tapemetric.com/v1/ingest/events should return 202.

What’s next