Tapemetric

SDKs

React Native SDK

TypeScript wrapper bridging to the native Android and iOS SDKs for full ExoPlayer and AVPlayer support.

Install

bash
npm install @tapemetric/analytics-react-native

Auto-linking handles the native side. No pod install quirks required on iOS.

Initialize

App.tsx
import { useEffect } from 'react';
import Tapemetric from '@tapemetric/analytics-react-native';

export default function App() {
  useEffect(() => {
    Tapemetric.init({
      apiKey: Config.TAPEMETRIC_KEY,
      debug: __DEV__,
    });
  }, []);
  return <NavigationContainer>{/* ... */}</NavigationContainer>;
}

Identify

typescript
Tapemetric.identify('user_12345', { plan: 'svod' });
Tapemetric.reset();

react-native-video integration

tsx
import Video from 'react-native-video';

const bufStart = useRef<number>(0);

<Video
  source={{ uri: manifestUrl }}
  onLoadStart={() => {
    Tapemetric.trackPlayStart(
      { contentId: 'ep_001', contentType: 'series', contentTitle: 'Aashiqana S4 E12' },
      { positionSec: 0 },
    );
  }}
  onBuffer={({ isBuffering }) => {
    if (isBuffering) bufStart.current = Date.now();
    else if (bufStart.current) {
      Tapemetric.trackBuffer(Date.now() - bufStart.current, { positionSec: 0 });
      bufStart.current = 0;
    }
  }}
  onEnd={() => Tapemetric.trackComplete({ positionSec: duration, durationSec: duration })}
/>

Screen tracking with React Navigation

tsx
import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';

const ref = useNavigationContainerRef();
const routeRef = useRef<string | null>(null);

<NavigationContainer
  ref={ref}
  onReady={() => { routeRef.current = ref.getCurrentRoute()?.name ?? null; }}
  onStateChange={() => {
    const next = ref.getCurrentRoute()?.name ?? null;
    if (next && next !== routeRef.current) {
      Tapemetric.trackPageView(next);
      routeRef.current = next;
    }
  }}
>
  {/* screens */}
</NavigationContainer>

Revenue

typescript
Tapemetric.trackPurchase('mumbai_junction', 149, 'tvod');

Expo

This SDK requires native modules, so it works in Expo bare workflow but not in Expo Go. Useexpo prebuild to generate the native projects and the auto-linking will take it from there.