Important
The setup
API must be called before the startSession
API.
All other APIs must be called after both the setup
and startSession
APIs, otherwise they will be ignored.
The setDebugMode
API is the exception to that rule and may be called anywhere in the code.
setup ⇒ void
startSession ⇒ void
setVisitorData ⇒ void
setAccountData ⇒ void
endSession ⇒ void
track ⇒ void
pauseGuides ⇒ void
resumeGuides ⇒ void
dismissVisibleGuides ⇒ void
getDeviceId ⇒ String
getVisitorId ⇒ String
getAccountId ⇒ String
setDebugMode ⇒ void
static Future<void> setup(String appKey, {Map<String, dynamic>? pendoOptions}) async
Establishes a connection with Pendo’s server. Call this API in your application’s main file (lib/main.dart). The setup method can only be called once during the application lifecycle. Calling this API is required before tracking sessions or invoking session-related APIs.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
appKey | String | The App Key is listed in your Pendo Subscription Settings in App Details |
pendoOptions | Map<String, dynamic>? | PendoOptions should be null unless instructed otherwise by Pendo Support |
Example:
await PendoSDK.setup('your.app.key', null);
static Future<void> startSession(String? visitorId, String? accountId, Map<String, dynamic>? visitorData, Map<String, dynamic>? accountData) async
Starts a mobile session with the provided visitor and account information. If a session is already in progress, the current session will terminate and a new session will begin. The termination of the app will also terminate the session.
To generate an anonymous visitor, pass 'nil' as the visitorId. Visitor data and Account data are optional.
No action will be taken if the visitor and account IDs do not change when calling the startSession API during an ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
visitorId | String? | The session visitor ID. For an anonymous visitor set to null |
accountId | String? | The session account ID |
visitorData | Dictionary<string, object>? | Additional visitor metadata |
accountData | Dictionary<string, object>? | Additional account metadata |
Example:
Map<String, dynamic> visitorData = {'age': 21, 'country': 'USA'};
Map<String, dynamic> accountData = {'Tier': 1, 'Size': 'Enterprise'};
await PendoSDK.startSession('John Doe', 'ACME', visitorData, accountData)
static Future<void> setVisitorData(Map<String, dynamic> visitorData) async
Updates the visitor metadata of the ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
visitorData | Map<String, dynamic> | The visitor metadata to be updated |
Example:
Map<String, dynamic> visitorData = {'age': 25, 'country': 'UK', 'birthday': '01-01-1990'};
await PendoSDK.setVisitorData(visitorData)
static Future<void> setAccountData(Map<String, dynamic> accountData) async
Updates the account metadata of the ongoing session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
accountData | Map<String, dynamic> | The account metadata to be updated |
Example:
Map<String, dynamic> accountData = {'Tier': 2, 'size': 'Mid-Market', 'signing-date': '01-01-2020'};
await PendoSDK.setAccountData(accountData)
static Future<void> endSession() async
Ends the active session and stops collecting analytics or showing guides to the user. A new session can be started by calling the startSession API.
This API is commonly used when the user logs out of your application.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
await PendoSDK.endSession();
static Future<void> track(String event, Map<String, dynamic>? properties) async
Sends a track event with the specified properties.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
event | String | The track event name |
properties | Map<String, dynamic>? | Additional metadata to be sent as part of the track event |
Example:
await PendoSDK.track('App Opened', {'Theme': 'Dark Mode'});
static Future<void> pauseGuides(bool dismissGuides) async
Pauses any guides from appearing during an active session. If the
dismissGuides
value is set totrue
, then any visible guide will be dismissed. Calling this API affects the current session. Starting a new session reverts this logic, enabling guides to be presented.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
dismissGuides | bool | Determines whether the displayed guide, if one is visible, is dismissed when pausing the display of the further guides |
Example:
await PendoSDK.pauseGuides(false);
static Future<void> resumeGuides() async
Resumes displaying guides during the ongoing session. This API reverses the logic of the
pauseGuides
API.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
await PendoSDK.resumeGuides();
static Future<void> dismissVisibleGuides() async
Dismisses any visible guide.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Example:
await PendoSDK.dismissVisibleGuides();
static Future<String?> getDeviceId() async
Returns the device's unique Pendo-generated ID.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
await PendoSDK.getDeviceId();
static Future<String?> getVisitorId() async
Returns the ID of the visitor in the active session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
await PendoSDk.getVisitorId();
static Future<String?> getAccountId() async
Returns the ID of the account in the active session.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: String
Example:
await PendoSDK.getAccountId();
static Future<void> setDebugMode(bool isDebugEnabled) async
Enable/disable debug logs from Pendo SDK. To debug the Pendo SDK we recommend calling this API before calling the setup API.
Debug logs are turned off by default. Releasing your production app with the debug logs enabled is not recommended and may have performance repercussions on your app.
Details - Click to expand or collapse
Class: PendoSDK
Kind: static method
Returns: void
Param | Type | Description |
---|---|---|
isDebugEnabled | bool | Set to true to enable debug logs, false to disable |
Example:
await PendoSDK.setDebugMode(true);
await PendoSDK.setup("your.app.key", null);