Moments API Module
Learn how to install the Tealium Moments API module for Flutter.
Tealium for Flutter allows you to use the Tealium mobile libraries (iOS, Android) to install the Moments API Module for the Tealium Flutter plugin.
How It Works
Tealium mobile libraries can be integrated into your Flutter application using one of the following methods:
- Dart package (recommended)
- Manually via GitHub
Requirements
- Flutter application development framework
- IDE, such as Android Studio or VS Code
- Flutter plugin installed on the IDE
Install
To install the Tealium library for Flutter:
- In your Flutter app project, run the following command:
dart pub add tealium_moments_api
- Import the following Dart code into your project:
import 'package:tealium_moments_api/common.dart'; import 'package:tealium_moments_api/tealium_moments_api.dart';
Initialize
Configure the Moments API module before initializing the main Tealium Flutter integration.
Set the Moments API Region as specified in the Moments API interface. The following regions are available:
GERMANY
US_EAST
SYDNEY
OREGON
TOKYO
HONG_KONG
If you are using the domain allow list, set the referrer to an allowed domain.
The following example code uses the US_EAST
region and example.com
as the referrer to match the allowed domain:
MomentsApiConfig config = MomentsApiConfig(
MomentsApiRegion.US_EAST, // required
"https://example.com"); // optional
// Configure the module
TealiumMomentsApi.configure(config);
// ... Initialize main Tealium plugin
Class: TealiumMomentsApi
After the Moments API Module and the main Tealium Flutter integration have both been initialized, you can retrieve engine data by ID.
fetchEngineResponse
Retrieves the engine response for the given engine ID.
TealiumMomentsApi.fetchEngineResponse(
engineId: "ENGINEID",
callback: (response) {
if (response is EngineResponse) {
// handle success
String audiences = response.audiences
// do something
} else if (response is String) {
// handle error
}
}
);
Parameter
Parameter | Description |
---|---|
engineId | The ID of the engine to check. |
This page was last updated: February 21, 2025