clicklens 0.1.0
clicklens: ^0.1.0 copied to clipboard
ClickLens product analytics for Flutter apps on Android, iOS, web, macOS, Windows and Linux. Batched, retried, offline-safe event tracking.
example/lib/main.dart
// A one-screen app showing the whole ClickLens API.
import 'package:clicklens/clicklens.dart';
import 'package:flutter/material.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await ClickLens.init('YOUR_PROJECT_TOKEN', debug: true);
ClickLens.registerSuperProperties({'app_version': '1.0.0'});
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('ClickLens example')),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FilledButton(
onPressed: () =>
ClickLens.track('Order placed', {'total': 1200}),
child: const Text('Track an event'),
),
const SizedBox(height: 8),
FilledButton(
onPressed: () {
ClickLens.identify('user-42');
ClickLens.setProfile({r'$email': 'person@example.com'});
},
child: const Text('Identify'),
),
const SizedBox(height: 8),
FilledButton(
onPressed: ClickLens.reset,
child: const Text('Log out'),
),
const SizedBox(height: 8),
FilledButton(
onPressed: ClickLens.flush,
child: const Text('Send now'),
),
],
),
),
),
);
}
}