/analytics-flutter

:iphone: Flutter SDK to send tracking events to Reelevant

Primary LanguageDartApache License 2.0Apache-2.0

Tests iOS Android Pub Version Pub Likes Pub Points Pub Popularity Pub Publisher

Reelevant Analytics SDK for flutter (iOS and Android)

This Flutter package could be used to send tracking events to Reelevant datasources.

Install

Run this command:

flutter pub add reelevant_analytics

See pub.dev for more informations.

How to use

You need to have a datasourceId and a companyId to be able to init the SDK and start sending events:

final reelevantAnalytics = ReelevantAnalytics(companyId: '<company id>', datasourceId: '<datasource id>');

// Generate an event
var event = reelevantAnalytics.pageView(labels: {});
// Send it
reelevantAnalytics.send(event);

Current URL

When a user is browsing a page you should call the sdk.setCurrentURL method if you want to be able to filter on it in Reelevant.

User infos

To identify a user, you should call the sdk.setUser('<user id>') method which will store the user id in the device and send it to Reelevant.

Labels

Each event type allow you to pass additional infos via labels (Map<String, String>) on which you'll be able to filter in Reelevant.

var event = reelevantAnalytics.addCart(ids: ['my-product-id'], labels: {'lang': 'en_US'});

Contribute

This project is a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and iOS.

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.