Xamarin developer APIs for iOS

Last Updated:

This document describes the Pendo Xamarin SDK Public APIs for iOS. 

Pendo Class Public API - SDK Version 2.10+

Return type Public API method C# Description
static PendoManager SharedManger() Returns a shared instance of the PendoManager.
Void Setup (string appKey)

Initializes the Pendo SDK. Call this API in FinishedLaunching.

Use this API instead of initSDK and initSDKWithoutVisitor, which will be deprecated in future versions. 

Void StartSession (string? visitorId, string? accountId, NSDictionary? visitorData, NSDictionary? accountData)

Starts mobile session with provided visitor and account information. If a session is already in progress, the session will end and a new session will start.

To generate an anonymous visitor, pass null as the  visitorId.

Use this API instead of switchVisitor, which will be deprecated in future versions. 

Must be called after the SDK is initialized.

Void EndSession()

Ends the active session and stops collecting analytics or showing guides to the user. More details here.

Must be called after the SDK is initialized.

Void ClearVisitor()

Ends the active session and starts a new session with an anonymous visitor.

Must be called after the SDK is initialized.

Void SetVisitorData (NSDictionary visitorData)

Updates the visitor metadata. 

Must be called after the SDK is initialized.

Void SetAccountData (NSDictionary AccountData)

Updates the account metadata

Must be called after the SDK is initialized.

String GetVisitorId() Returns the ID of the visitor in the active session.
String GetAccountId() Returns the ID for the account in the active session. 
Void AccountId Sets the ID for the account in the active session. 
Void Track (string eventName, NSDictionary? @params)

Sends a track event with the specified properties.

Must be called after the SDK is initialized.

Void DismissVisibleGuides() Dismisses all visible guides.
Void PauseGuides (bool dismissGuides)

Pauses any guides from showing during an active session. If dismissGuides is TRUE, then all visible guides will be dismissed.

Must be called after the SDK is initialized.

Void ResumeGuides()

Resumes showing guides during the active session. Should only be used after pauseGuides. 

Must be called after the SDK is initialized.

String GetDeviceId() Returns the device's unique Pendo-generated id. The device id is used by Pendo to generate a unique id for each anonymous visitor. This id is unique per application.

 

Pendo initialization guidelines

  1. setup should only be called once during the application lifecycle.
  2. startSessionmay take time to complete, depending on network connectivity. NSNotificationCenter should be used to receive notifications when Pendo SDK initialization completes. 
  3. startSession is used to set a visitorID and/or AccountID. No action is taken if the Visitor and Account ID do not change. 
  4. endSession should be used to end the visitor session when the user logs out of the application. 

SDK initialization 

setupshould be placed in the AppDelegate (FinishedLaunching)

Setup the SDK 

using Pendo;

Add the following code in the FinishedLaunching method

string appKey = "YOUR_APP_KEY";
PendoManager.SharedManager().setup(appKey);

Start mobile session

When you want to start the session with a visitor (identified or anonymous) call startSession. To generate an anonymous visitor, pass null as the visitorId.

using Pendo;

Add the following code to your application where your visitor is known: 

Identified Visitor 

var visitorId = "John Smith";
var accountId = "Acme Inc";
// Set visitor metadata
var visitorData = new NSDictionary("Age", 27, "Country", "USA", "Gender", "Male");
// Set account metadata
var accountData = new NSDictionary("Tier", 1, "Timezone", "EST", "Size", "Enterprise");

Anonymous Visitor

var visitorId = null;
var accountId = null;
var visitorData = null;
var accountData = null;

Call startSession() method - This code starts the mobile session and retrieves all guides based on the provided information.

PendoManager.SharedManager().StartSession(visitorId, accountId, visitorData, accountData);

Track Events flow

This method allows you to pass track event information using the Pendo SDK. 

var eventProperties = new NSDictionary("property1", "value1", "property2", "value2");
PendoManager.SharedManager().Track("customEvent1", eventProperties);

 

Was this article helpful?
0 out of 0 found this helpful