Note
The following integration instructions are relevant for SDK 3.0 or higher.
Follow our migration instructions to upgrade from SDK 2.x to 3.0 or refer to our 2.x integration instruction.
Important
Requirements:
- .NET 4
- Xamarin.Forms version 5.0.0.2612 or higher
- In Visual Studio Solution Explorer, right-click on your shared project, then select "Add" - > "Add NuGet Packages…".
- Search for: pendo-xamarin-forms with latest version.
- Press Add Package.
Note
The API Key
can be found in your Pendo Subscription Settings in App Details.
-
Open the shared project App.xaml.cs:
Add the following code:
using PendoSDKXamarin; namespace ExampleApp { public partial class App : Application { private static IPendoInterface pendo = DependencyService.Get<IPendoInterface>(); ... } ...
In the protected override void OnStart() method, add the following code:
protected override void OnStart() { string apiKey = "YOUR_API_KEY_HERE"; pendo.Setup(apiKey); ... }
-
Start the visitor's session in the page where your visitor is being identified (e.g. login, register, etc.).
using PendoSDKXamarin; namespace ExampleApp { class ExampleLoginClass { private static IPendoInterface pendo = DependencyService.Get<IPendoInterface>(); public void ExampleMethod() { ... var visitorId = "VISITOR-UNIQUE-ID"; var accountId = "ACCOUNT-UNIQUE-ID"; var visitorData = new Dictionary<string, object> { { "age", 27 }, { "country", "USA" } }; var accountData = new Dictionary<string, object> { { "Tier", 1 }, { "Size", "Enterprise" } }; pendo.StartSession(visitorId, accountId, visitorData, accountData); ... } ... } }
visitorId: a user identifier (e.g. John Smith)
visitorData: the user metadata (e.g. email, phone, country, etc.)
accountId: an affiliation of the user to a specific company or group (e.g. Acme inc.)
accountData : the account metadata (e.g. tier, level, ARR, etc.)This code ends the previous mobile session (if applicable), starts a new mobile session and retrieves all guides based on the provided information.
Tip
To begin a session for an anonymous visitor, pass null
or an empty string ''
as the visitor id. You can call the startSession
API more than once and transition from an anonymous session to an identified session (or even switch between multiple identified sessions).
Note
The Scheme ID
can be found in your Pendo Subscription Settings in App Details.
These steps enable page tagging and guide testing capabilities.
-
Add a Pendo URL scheme to the info.plist file:
Under the iOS App Target > open info.plist > if
URL Types
doesn't exist, click on 'Add new entry' of typeArray
and name itURL types
. Create a newDictionary
inside theArray
with two entries:URL identifier
of typeString
with a value that begins withpendo
(ex.pendo-scheme-d
).URL Schemes
of typeArray
. Add aString
item withYOUR_SCHEME_ID
as the value.
-
Add or modify the function OpenURL:
Open AppDelegate.cs file and the following code:
using PendoForms; ... public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { if (url.Scheme.Contains("pendo")) { PendoManager.InitWithUrl(url.AbsoluteString); return true; } return base.OpenUrl(app, url, options); }
- Test using Visual Studio:
Run the app.
Review the Xcode console and look for the following message:
Pendo SDK was successfully integrated and connected to the server.
- In the Pendo UI, go to Settings>Subscription Settings.
- Select the Applications tab and then your application.
- Select the Install Settings tab and follow the instructions under Verify Your Installation to ensure you have successfully integrated the Pendo SDK.
- Confirm that you can see your app as Integrated under subscription settings.
- API documentation available here.
- For technical issues, please review open issues or submit a new issue.
- Release notes can be found here.
- For additional documentation, visit our Help Center Mobile Section.