The Lumen flutter plugin allows you to seamlessly identify and track user attributes and events on your app. Plus other perks.

Getting Started

  1. Setup your Lumen account

  2. To retrieve your API key, navigate to Settings.

  3. Select the API Key tab to view and copy your key.


flutter pub add lumen

Initialize the plugin

To use the plugin, you have to initialize the plugin with your API key. Any request that doesn't include a valid API key will return an error.

You can generate an API key from the dashboard at any time.

import 'package:lumen/lumen.dart';

const lumenApiKey = "<< your-api-key >>";

void main() {

  runApp(const MyApp());


Identify a user

You must identify users with a unique identifier before you can track their events. A new customer record is created if the identifier doesn't exist. If the identifier exists, then the customer record is updated with the new data supplied.

final identifyData = IdentifyData(
    email: "johndoe@example.com", // required
    first_name: "john",
    last_name: "doe",
    phone_number: "0123456789",
    device_id: "device ID");

Lumen.identify("<< user-identifier >>", identifyData);

Ideally, identify should be called when a user creates a new account. To update an existing user’s records, simply call identify and add any property you want to add or change. If the property already exists, we overwrite them. If it is new, we add them to the user's record.

To ensure your data is in sync with our record, make sure you update your user's records when they change so as to prevent stale data.

You can manage your user records on the dashboard.

Track an event

After identifying users, you can now capture their actions like "Product Clicked" or "Product Viewed" with other custom properties.

Lumen.track("identifier", "Clicked 'Add To Cart'");

// >> with custom properties

final customTrackProperties = {"value": "1233"};

Lumen.track("identifier", "Clicked 'Add To Cart'", customTrackProperties);

Last updated