retainpixel 0.1.0 copy "retainpixel: ^0.1.0" to clipboard
retainpixel: ^0.1.0 copied to clipboard

RetainPixel SDK for Flutter/Dart. Lightweight event tracking for mobile apps.

example/main.dart

import 'package:retainpixel/retainpixel.dart';

/// Example usage of the RetainPixel Flutter SDK.
///
/// Wire this into your app's initialization and key user actions.
Future<void> main() async {
  final rp = RetainPixelClient(RetainPixelConfig(
    orgId: 'YOUR_ORG_UUID',
    appId: 'YOUR_APP_UUID',
    apiKey: 'YOUR_API_KEY',
    environment: 'live',
    // For local dev:
    // endpoint: 'http://localhost:8787',
  ));

  await rp.init();

  // --- SportFX P0 events ---

  // 1. User signs up
  rp.identify('user-firebase-uid');

  // 2. Onboarding complete
  rp.track('onboarding_complete', activationState: ActivationState.setup);

  // 3. First video uploaded
  rp.track('video_uploaded', properties: {'duration_seconds': 45});

  // 4. Analysis viewed
  rp.track('analysis_viewed', activationState: ActivationState.firstValue);

  // 5. Winston message received
  rp.track('winston_message_received');

  // 6. Paywall exposed
  rp.paywallExposure(properties: {'plan': 'pro_monthly'});

  // 7. Trial started
  rp.track('trial_started', activationState: ActivationState.trialStarted);

  // 8. Payment completed
  rp.revenue(9.99, properties: {'plan': 'pro_monthly', 'period': 'monthly'});

  // 9. Screen views
  rp.screen('home_feed');
  rp.screen('analysis_detail');

  // 10. Experiment exposure
  rp.experimentExposure('paywall_timing_v1', 'variant_a');

  // Flush on app background / dispose
  await rp.flush();

  // Clean up
  await rp.dispose();
}
0
likes
160
points
129
downloads

Documentation

API reference

Publisher

verified publisherretainpixel.com

Weekly Downloads

RetainPixel SDK for Flutter/Dart. Lightweight event tracking for mobile apps.

Homepage
Repository (GitHub)

License

MIT (license)

Dependencies

crypto, http, shared_preferences, uuid

More

Packages that depend on retainpixel