Xamarin Developer API Documentation iOS

Overview

This document describes the Pendo Xamarin SDK Public APIs for iSO 

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.

This API should be used instead of initSDK and initSDKWithoutVisitor that 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.

This API should be used instead of switchVisitor that will be deprecated in future versions. 

Must be called after the SDK was initialized.

Void

EndSession()

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

Must be called after the SDK was initialized.

Void

ClearVisitor()

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

Must be called after the SDK was initialized.

Void

SetVisitorData (NSDictionary visitorData)
 

Update the visitor metadata. 

Must be called after the SDK was initialized.

Void

SetAccountData (NSDictionary AccountData)

Update the account metadata

Must be called after the SDK was 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 was initialized.

Void

DismissVisibleGuides()

Dismisses all visible guide.

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 was initialized.

Void

ResumeGuides()

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

Must be called after the SDK was 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 Class Public APIs - SDK Version 2.9 and lower 

Return type

Public API method C#

Description

Void

InitSDK (string appKey, PendoInitParams? initParams)
 

Initializes the Pendo SDK using the specified app key and params.

Void

InitSDKWithoutVisitor (string appKey)
 
 

Initializes the Pendo SDK without visitor and account data, using the specified app key.

Void

SwitchVisitor (string? visitorId, string? accountId, NSDictionary? visitorData, NSDictionary? accountData)
 

Ends the current session when there is an active session then starts a new session with the new visitor and account information. 

Passing nil as the visitorId will generate an anonymous visitor id. 

Must be called after the SDK was initialized.

 

Pendo Initialization Guidelines

  1. setupshould 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 will be taken if Visitor and Account ID did 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 would like 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 will start the mobile session and retrieve 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);