Skip to main content

herald_adjust 1.0.0-dev.2 copy "herald_adjust: ^1.0.0-dev.2" to clipboard
herald_adjust: ^1.0.0-dev.2 copied to clipboard

A Herald vendor adapter that sends to Adjust: events by dashboard token, purchases and ad revenue.

example/herald_adjust_example.dart

import 'package:adjust_sdk/adjust_config.dart';
import 'package:flutter/widgets.dart';
import 'package:herald/herald.dart';
import 'package:herald_adjust/herald_adjust.dart';

final class const CheckoutStarted(final String plan, final int seats) extends Event {
  @override
  String get name => 'checkout_started';

  @override
  Map<String, AnalyticsValue> get parameters => {'plan': .string(plan), 'seats': .int(seats)};
}

HeraldProvider adjustProvider(AdjustConfig config) {
  final tracker = AdjustAnalyticsTrackerService(
    eventTrackerFactory: CompositeAdjustEventTrackerFactory([
      TokenAdjustEventTrackerFactory({'checkout_started': 'abc123'}), // from your Adjust dashboard
    ]), // nothing at the end: only events with a token are sent
    propertySetterFactory: CompositeAdjustPropertySetterFactory([
      const GenericAdjustPropertySetterFactory(),
    ]),
  );
  final service = AdjustAnalyticsService(config); // starts Adjust itself, silent until consent
  return HeraldProvider(
    name: 'adjust',
    events: tracker,
    properties: tracker,
    identity: service,
    lifecycle: service,
    consent: service,
  );
}

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final herald = Herald(
    providers: [adjustProvider(AdjustConfig('YOUR_APP_TOKEN', AdjustEnvironment.sandbox))],
  );

  await herald.start();
  await herald.setEnabled(true); // the user agreed
  await herald.track(const CheckoutStarted('pro', 3));
}
0
likes
0
points
565
downloads

Publisher

unverified uploader

Weekly Downloads

A Herald vendor adapter that sends to Adjust: events by dashboard token, purchases and ad revenue.

Repository (GitHub)
View/report issues

Topics

#analytics #adjust #attribution #tracking

License

unknown (license)

Dependencies

adjust_sdk, flutter, herald

More

Packages that depend on herald_adjust