SDK documentation

Send the right signals. Keep personal data out.

Add consent-aware journey analytics and click attribution to web, Expo, React Native, and Flutter applications.

Current SDKs

JavaScript 0.3.0

Flutter 0.2.0

Android, iOS, Expo, React Native, and browsers.

01Get started

From a new account to your first signal

SDK setup belongs to a network owner or admin. Affiliate partner accounts can view their own performance, but they cannot create offers or application write keys.

  1. 01

    Create a network

    Open an isolated workspace and its owner-admin account.

  2. 02

    Create an offer

    Connect analytics to the campaign receiving attributed traffic.

  3. 03

    Issue a write key

    Create one analytics app for each customer application.

  4. 04

    Install and verify

    Connect consent, send a test signal, and check Reports.

1

Create the network-owner account

Open the account page, choose Start a network, then enter the network name, subdomain, owner name, email, and a password of at least six characters. Successful registration signs the owner in and opens the dashboard.

Open account setup
2

Create the offer

In Offers, select New offer. Add its destination URL and attribution window, then save it. Each analytics app is scoped to one offer in the same network. The authenticated GET /api/offers response contains its UUID.

Manage offers
3

Create an analytics app and write key

Open SDK Keys, selectNew application, connect its offer, and generate the key. Copy the key before closing—the inventory shows only its prefix afterward.

Manage SDK keys

For automated provisioning, an admin can use the same API directly:

Admin sign-inshell
curl -X POST https://api.example.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@example.com",
    "password": "YOUR_ADMIN_PASSWORD",
    "network": "your-network"
  }'
Create analytics appshell
curl -X POST https://api.example.com/api/analytics/apps \
  -H "Authorization: Bearer YOUR_ADMIN_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "offer_id": "YOUR_OFFER_UUID",
    "name": "Customer production app"
  }'

The 201 response contains id andwrite_key. Copy the write key now; later list responses expose only its prefix.

Never place the admin password or JWT in a website or mobile build.

02Platform setup

Choose your runtime

JavaScript SDK 0.3.0

Browser & Next.js

For browser-rendered websites and single-page applications. Initialize from client code so Web Storage is available.

View package
Installshell
npm install @dozz-affiliate/analytics-sdk@^0.3.0
Initializejs
"use client";

import {
  createAnalyticsSdk,
  createWebStorageAdapter,
} from '@dozz-affiliate/analytics-sdk/browser';

export async function initializeAnalytics() {
  const analytics = createAnalyticsSdk({
    endpoint: 'https://api.example.com/sdk/v1/events',
    writeKey: 'YOUR_PUBLIC_APP_WRITE_KEY',
    storage: createWebStorageAdapter(window.localStorage),
  });

  await analytics.initialize(window.location.href);
  return analytics;
}

JavaScript SDK 0.3.0

Expo & React Native

Uses AsyncStorage for the durable queue and Expo Crypto for secure UUIDs. Forward initial and later deep links for attribution.

View package
Installshell
npm install @dozz-affiliate/analytics-sdk@^0.3.0
npx expo install @react-native-async-storage/async-storage expo-crypto expo-linking
Initializejs
import AsyncStorage from '@react-native-async-storage/async-storage';
import * as Crypto from 'expo-crypto';
import * as Linking from 'expo-linking';
import {
  createAnalyticsSdk,
  createAsyncStorageAdapter,
} from '@dozz-affiliate/analytics-sdk/react-native';

export async function initializeAnalytics() {
  const analytics = createAnalyticsSdk({
    endpoint: process.env.EXPO_PUBLIC_DOZZ_ENDPOINT,
    writeKey: process.env.EXPO_PUBLIC_DOZZ_WRITE_KEY,
    storage: createAsyncStorageAdapter(AsyncStorage),
    uuidFactory: () => Crypto.randomUUID(),
  });

  await analytics.initialize(await Linking.getInitialURL());
  return analytics;
}

Flutter SDK 0.2.0

Flutter

Supports Android and iOS with durable Shared Preferences storage and a lifecycle observer for background delivery.

View package
Installshell
flutter pub add dozz_analytics_sdk:^0.2.0
Initializedart
import 'package:dozz_analytics_sdk/dozz_analytics_sdk.dart';
import 'package:http/http.dart' as http;

Future<({DozzAnalyticsSdk sdk, DozzAnalyticsLifecycle lifecycle, http.Client client})>
initializeAnalytics() async {
  final client = http.Client();
  final sdk = DozzAnalyticsSdk(
    config: DozzAnalyticsConfig(
      endpoint: Uri.parse('https://api.example.com/sdk/v1/events'),
      writeKey: const String.fromEnvironment('DOZZ_WRITE_KEY'),
    ),
    storage: SharedPreferencesDozzStorage(),
    httpClient: HttpDozzClient(client),
  );

  await sdk.initialize();
  final lifecycle = DozzAnalyticsLifecycle(sdk)..start();
  return (sdk: sdk, lifecycle: lifecycle, client: client);
}

04Track events

Capture the journey, not the person

Emit an event only after the business action actually occurs. The canonical catalog covers the normal ride-hailing lifecycle; custom lowercase events remain available for customer-specific actions.

Track a lifecyclejs
import { JOURNEY_EVENTS } from '@dozz-affiliate/analytics-sdk';

await analytics.trackEvent(JOURNEY_EVENTS.account.registrationCompleted, {
  auth_method: 'phone_otp',
});

await analytics.trackScreen('ride_home', {
  entry_kind: 'deep_link',
});

await analytics.trackRide('requested', {
  vehicle_class: 'standard',
  estimated_fare_bucket: '10_15',
});

await analytics.flush();

Application

  • app_opened
  • screen_viewed
  • tap_recorded

Account

  • account_registration_started
  • account_registration_completed
  • account_registration_failed
  • account_login_started
  • account_login_completed
  • account_login_failed
  • account_logout_completed

Onboarding

  • onboarding_started
  • permission_prompted
  • permission_responded
  • onboarding_completed

Discovery

  • destination_search_started
  • destination_selected
  • ride_quote_viewed
  • vehicle_selected
  • promotion_applied
  • promotion_rejected

Ride

  • ride_requested
  • ride_matched
  • ride_match_failed
  • driver_arriving
  • driver_arrived
  • ride_started
  • ride_completed
  • ride_cancelled

Payment

  • payment_method_selected
  • payment_started
  • payment_completed
  • payment_failed
  • payment_refunded

Follow-up & safety

  • rating_submitted
  • support_opened
  • support_contacted
  • safety_feature_opened
  • emergency_assistance_requested

05Privacy model

Deliberately narrow by design

Only a UUID click_id is accepted for attribution.

Queued events persist for offline delivery after consent.

Names, email, phone, coordinates, tokens, and free text are blocked.

Pickup and destination addresses, rider/driver IDs, promo codes, and payment details are blocked.

Client events cannot approve conversions or calculate payouts.

06Verify delivery

Confirm the full path

In a test environment, grant consent, send one allowlisted event, and flush the queue. A JavaScript delivery with sent: 1 was acknowledged. Open Reports and check Recent signals for the selected offer.

Open Reports
Delivery checkjs
const eventId = await analytics.trackEvent('sdk_tested', {
  stage: 'integration',
});

const delivery = await analytics.flush();
console.log({ eventId, sent: delivery.sent });

07API reference

JavaScript methods

initialize(initialUrl)
Restore state and optionally capture a click ID.
setConsent(state)
Persist granted, denied, or unknown consent.
captureAttribution(url)
Capture a trusted UUID click_id from a URL.
trackEvent(name, properties)
Queue a custom allowlisted event.
trackScreen / trackTap / trackRide
Queue canonical convenience events.
flush()
Attempt the next ready delivery batch.
stop() / reset()
Stop delivery or erase all analytics state.

Flutter exposes the same lifecycle and tracking concepts through DozzAnalyticsSdk; asynchronous methods return Future values.