Xamarin Getting Started

Learn more about installing the Pyze Xamarin Smart SDK, initializing it, using events and setting up In-app or push notifications. The Pyze SDK supports Android versions 4.0.3 (minSdkVersion 15) and above for Android and iOS version 7 or above for iOS.

1. Get one or more Pyze App Keys

  • Get one or more Pyze App Keys depending on platforms you support:
  • See instructions to for iOS.
  • See instructions to for Android.

2. Install the Pyze SDK

3. Setup & Initialize

Build and Go!

You have enabled all screen flow funnels, loyalty, cohort and churn analysis, Intelligence data explorations, built-in events, auto segmentation, and much more. Use your app with the Pyze SDK and you should see data on growth.pyze.com.

In the following sections, you can add app-defined-, timed- and curated- events. To reach out to your users and create meaningful relationships, add push and in-app notifications.

4. Add events

A comprehensive overview of curated, app defined, timed and built-in events is available under Events in the api & events.

5. Build meaningful relationships with your users

Pyze delivers intelligence-driven marketing and growth automation, so you can build meaningful relationships with your users.

App SDK API, Samples, Resources for Xamarin developers

iOS - Xamarin

Install & Initialize

Get Pyze App Keys

Get a Pyze App Key (PAK) for iOS and Android Xamarin apps from growth.pyze.com expand all sections collapse all sections

1. Login to growth.pyze.com

Every app is uniquely assigned a Pyze App Key (PAK), a 22 character app specific key, which you obtain from growth.pyze.com after logging in with your email and password. If you have not signed up for Pyze, you can Get Pyze here first.

Login to growth.pyze.com

2. Add a new app

Click on the Add App button on top right corner and provide the details for your app, including name, platform and optional URL for the app store. Specify the timezone where you are located.

3. Copy Pyze App Key from newly added app

Hover over the newly added app with rotating Pyze logo and copy the Pyze App Key (jUiix5alQ7KYSlG6ZQ_TXw in this example). Alternatively, you click on the “App Profile” icon and copy the PAK from the App profile page.

Alternatively, you click on the “App Profile” icon and copy the PAK from the App profile page.

Install Pyze Xamarin Package

1. Download Pyze Xamarin iOS Binding

  • [Download Pyze-Xamarin-iOS.dll from here

2. Add Pyze iOS Binding in your Xamarin project

  • Add the Pyze_Xamarin_iOS.dll under .iOS -> References
  • Right click on References -> Edit References -> .Net Assembly -> Browse the dll -> Ok

Congratulations!, your Xamarin project now has the Pyze SDK.

Pyze Xamarin App SDK: Setup & Initialize

The instructions on this page assume you have installed the Pyze SDK into your Xamarin project. If not, Install the SDK and come back to this page. See Getting Started Xamarin Guide.

Setup

After importing Pyze Xamarin Binding, you must initialize the Pyze library.

Inside the AppDelegate of the application override the WillFinishLaunching lifecycle callback of the application and call Pyze.Initialize.

public override bool WillFinishLaunching(UIApplication application, NSDictionary launchOptions)
{
            Pyze.Initialize("Your Pyze App Key");
            return true;
}

Alternatively you can pass the log throttling setting as the second parameter.

Ex:
Pyze.Initialize("Your Pyze App Key", PyzeLogLevel.All);

Build and Go!

Add Events

Pyze Xamarin App SDK - Events

See a detailed Events Overview at api & events.

Curated Event Handling

Pyze has made it easy for you to capture events. We support many built-in events (see api).

For example, to send a custom “PostAdRequested” use:

using pyze.xamarin.iOS; //Import the PyzeXamarin package
    ...
    ...
var keys = new object [] { "key1", "key2" };
var values = new object [] { "value1", "value2" }:
var customAttributes = NSDictionary.FromObjectsAndKeys (values, keys);
PyzeAd.PostAdRequested("Google", "home", "(320, 160)","banner",customAttributes);

Custom Event Handling

We also support custom events in addition to built in events. See custom events class api for Xamarin.

For example, to send a custom “Blog read” event without attributes, use:

PyzeCustomEvents.PostWithEventName("Blog Read");

For example, to send a custom “Blog read” event with attributes, use:

var keys = new object [] { "screen", "seconds spent" };
var values = new object [] { "Home", "50" }:

PyzeCustomEvents.PostWithEventName("Blog Read", attributes);

Enable Mobile Marketing

Push Notifications (Xarmin - iOS)

Apple Push Notifications

Apple provides a Apple Push Notification service (APNs) to allow app developers to reach out to their users via push notifications.

The App businesses have the option of hosting and running servers “provider” themselves to send notification content “payload” to Apple over a persistent and secure channel using HTTP/2 multiplex protocol. Apple then forwards the notification content to your app on user’s device.

Pyze customers don’t have to maintain provider servers to communicate with Apple’s push notification service. Pyze can be used to send push notifications for an app in development, an app in production provisioned through the app store, and to a combination of apps in development and production.

Prerequisites

You will need access to your Apple developer Account, Xcode development environment, macOS Keychain Access, and finally iTunes Connect to publish your push-notification enabled app.

Using Pyze as your provider for push notifications

In the following sections, we will create APNs SSL certificates, use your Keychain to convert it into a file (.p12) and upload it to growth.pyze.com. We will also create a mobile provisioning file to import into Xcode. Then we will also enable Background Modes in your project using Xcode and write code to register for remote notifications in your app. Finally, we will enable your app with push notifications.

You will be doing a lot of configuring and clicking, but only write 4-5 lines of code.

1. Generate and download APNs SSL certificates
Login into your Apple developer Account
Create or Edit App and enable Push Notifications
  • From Apple developer Account, click on Certificate, Identifiers & Profiles. (Note: “People” resource is available to developers who you enroll as an organization, as opposed to an individual)

  • Under Identifiers group, click on App IDs. If creating a new app, click on the “+” button on top right. Or, if you have already created the app, select the app and click on the Edit button.

  • Get the bundle ID from your app

Enter your App Id Description and suffix (bundle id) and make sure you have enabled Push Notifications. Ensure the bundle ID that you provide matches the bundle ID that you’re using in your app. (This is a common mistake). Click on Continue.

<figure><img class="docimage" src="images/xamarin/register-app-ID.jpg" alt=""  /></figure>


<figure><img class="docimage" src="images/xamarin/bundle-id.jpg" alt=""  /></figure>


<figure><img class="docimage" src="images/xamarin/EnablePush.jpg" alt=""  /></figure>
Generate SSL certificate and download it
  • Once you successfully created the App-ID, select your App-ID and click the Edit button. In the resulting page scroll down to the Apple Push Notification service SSL Certificates section.

  • Click on Create Certificate button for either Development SSL certificate or Production SSL certificate. See Distribution considerations below.

  • You will be presented with instructions for creating a Certificate Signing Request (CSR) in Keychain Access. Do not click on Continue and please read the instructions provided by Apple and/or follow along below.

  • In the Applications folder on your Mac, open the Utilities folder and launch Keychain Access (Or press command-space and type Keychain Access). Within the Keychain Access Utilities App’s drop down menu, select Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.

  • In the Certificate Information window, enter the email address and a name for your private key. Leave CA Email Address field blank. In the “Request is” group, select the “Saved to disk” option. Click Continue and then save at a known location within Keychain Access to complete the CSR generating process.

  • Switch back to the Apple developer Account where you left of and click on Continue. Upload your Certificate Signing Request (CSR) needed to generate certificate.

  • Generate and then download the certificate as a .cer file

2. Generate Personal Information Exchange PKCS #12 (.p12)

Import certificates into Keychain Access and export Personal Information Exchange PKCS #12 (.p12) file

  • Import the certificate (.cer) you created, either by double clicking it or by choosing File > Import items in Keychain Access.

  • Ensure you have selected your certificate from ‘My Certificates’ under left hand side ‘Category’.

  • Select the certificate which you have added choose File > Export items from menu and export the certificate as Personal Information Exchange (.p12) file. While saving the p12, it is always recommended that you create a password. Note down your password, you will need it in the later steps.

3.Create Mobile Provisioning profile to download and import into Xcode

In this we will create a mobile provisioning profile in Apple developer Account, download it and import it into Xcode. The profile contains test devices you can send push notifications to during development.

  • Login into Apple developer Account, click on Certificate, Identifiers & Profiles.<br (Note: “People” resource is available to developers who you enroll as an organization, as opposed to an individual)

  • Select ‘All’ under Provisioning Profiles in Certificates, Identifiers & profiles. Click ‘+’ on top right to create a new profile

  • Depending on type of provisioning profile (development or production provisioning profile), select the right type. Click on Continue. See Distribution considerations below.

  • Select App ID which you have created. Click on Continue.

    Select iOS Development Certificate or iOS Production Certificate which you created and click on Continue.
    Select Devices pane appears, select device(s) which you would to want to test the APNs service and click on Continue
    Enter a profile name for your app, click Continue and Download the certificate and click Done.

    Note, if Certificates don’t exist, you will be prompted to create one.

  • Once you ‘Download’ the mobile provision certificate, import it into Xcode by double clicking downloaded mobile provisioning certificate.

  • Verify time and date of import into xcode, by opening terminal and typing the following. You should see the date time of the latest imports. ls -light ~/Library/MobileDevice/Provisioning\ Profiles

Joes-MacBook-Pro-15:~ awesomejoe$ ls -light ~/Library/MobileDevice/Provisioning\ Profiles
9453527 -rw-r--r-- 1 staff 7.7K Jan 8 15:27 cafebeef-dead-bead-fade-decadeaccede.mobileprovision

4. Configure Pyze as your provider

In order to allow Pyze to send push notifications on your behalf to users of your app, please provide the iOS push certificate to Pyze.

  • Login to growth.pyze.com
  • Navigate to the app you want to provide keys for
  • Select App Profile page either from the Portfolio page or menu

  • Select Push Notifications on the left menu
  • Upload a Push notifications certificate in .p12 format, provide p12 password (the password you generated while creating the certificate), and specify the provisioning mode: Development or Production depending on the type of certificate you are using.

  • Click Save
  • Select daily and weekly quota limits

5. Distribution considerations

Before you publish your app to AppStore or make a public Ad Hoc release, ensure you created a Production SSL certificate and used a Distribution mobile provisioning profile when following the steps above.

Also, ensure you have uploaded a Production .p12 certificate following steps mentioned in above section. Use Production Mode for Provisioning Mode.

6. Enable Remote Notifications in Xamarin IDE Project

You can either turn Remote Notifications on either from the Xamarin IDE or by editing the app’s property list (usually Info.plist) file depending on you preference.

Option 1: Using Xamarin IDE
  • In Xamarin IDE, open your plist file.
  • Open Background Modes, Enable Background Modes and Remote Notifications by clicking on the corresponding check marks.

Option 2: Editing app’s property list (usually Info.plist) file directly

Open your Info.plist file and add following lines

    <key>UIBackgroundModes</key>
    <array>
      <string>remote-notification</string>
    </array>
7. Enable your app for Push Notifications

Generate a build for iOS before proceeding.

Enable Remote Notifications

Open info.plist and enable background mode and check Remote notification option

Add the following snippet inside FinishedLaunching lifecycle callback of the App Delegate
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
   var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
          UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet());

     UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
     UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
else {
       UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
}
Override RegisteredForRemoteNotifications lifecycle callback of the App Delegate and add the following snippet
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
  // Get current device token
  var DeviceToken = deviceToken.Description;
  if (!string.IsNullOrWhiteSpace(DeviceToken))
  {
    DeviceToken = DeviceToken.Trim('<').Trim('>');
  }

  // Get previous device token
  //var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

  Pyze.SetRemoteNotificationDeviceToken(deviceToken);

  // Save new device token
  NSUserDefaults.StandardUserDefaults.SetString(DeviceToken, "PushDeviceToken");
}
Override DidReceiveRemoteNotification lifecycle callback of the App Delegate and add the following snippet
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler)
{
  Pyze.ProcessReceivedRemoteNotification(userInfo);
}

In-App Notifications

Enable In-app Notifications in your App

In-app notifications allow app publishers to reach out to app users when they use your app. In-App Notifications are deeply integrated in Pyze Growth Intelligence and allow app publishers to reach out to users from manually from Dynamic Funnels and Intelligence Explorer, and automatically based on workflows and campaigns from Growth Automation.

App publishers have full control over when to display the in-app messages and have two options: use the user interface provided by Pyze or develop their own.

Option 1. Use Pyze provided user interface
Invoke built-in User Interface from your app

You can look for In-App messages and invoke the built-in UI anywhere in your app. For example, on a button click or in your Start method or when new scene is loaded/unloaded.

Invoke UI from your app

  • Call the following method, whenever you want to show notification with default pyze UI. Method accepts a callback handler method which will be invoked whenever any of the call to action button on the UI is pressed.
Pyze.ShowUnreadInAppNotificationUIWithCompletionHandler((obj) =>
{

});
Option 2. Build your own user interface

You can provide your own user interface for in-app messages using the base level APIs

  • Get Count of New and Unfetched In-App Messages

    To get the count of new and un-fetched in-app messages you can call the following method.

     Pyze.CountNewUnFetched((obj) =>
     {
    
     });
    
  • Get Message Headers

    To get the message headers call the following method. Upto 20 messages are cached within the SDK. Using PyzeInAppMessageType you can fetch new unfetched messages, or previously fetched and cached in-app messages or you can get all messages.

     Pyze.GetMessageHeadersForType(PyzeInAppMessageType.All, (obj) =>
     {
    
     });
    
  • Get Message Body

    To get the message body call the following method with details of the messageHeaders

     Pyze.GetMessageBodyWithCampaignID("cid", "mid", (obj) =>
     {
    
     });
    
  • Implement handler for button clicks

    To display all unread messages

     //Get the unread message count
     Pyze.CountNewUnFetched((count) =>
     {
         //If there are any unread messages present
         if (count > 0)
         {
             //Get the message headers for all unread messages
             Pyze.GetMessageHeadersForType(PyzeInAppMessageType.Unread,(inAppStatusArray) =>
             {
                 // inAppStatusArray object has details about the unread messages
             });
         }
     });
    

Sending In-App notifications from growth.pyze.com

In-app notifications allow app publishers to reach out to app users when they use your app. In-App Notifications are deeply integrated in growth.pyze.com and allow app publishers to reach out to users from manually from Dynamic Funnels and Intelligence Explorer, and automatically based on workflows and campaigns from Growth Automation. For illustration purposes, we will send In-App Notifications from Dynamic Funnels.

  • Sending In-App notifications from Dynamic Funnels

    Create an event sequence, specify filters. You can reach out from either Dynamic Funnels or from Recent Sequences

    Create and send an In-app Notification. In this example, we will inform users of a tour we created for users

    View progress in Campaign History

Enable Personalization

Enable Personalization in your App

To learn more about personalization see here.

In Intelligence explorer, for example, you may assign “High Value” tag to users who match the following criteria. This tag will be available in your app to personalize content feed, experience, user interface or messaging.

  • High Engagement and High Loyalty or
  • High Advocacy and Seasonal Ticket Holder or
  • High Revenue or
  • High Engagement, High Advocacy, and Low or Medium Attrition Risk or

The Personalization Intelligence™ tags assigned to a user are available in the agent and are accessible via class PyzePersonalizationIntelligence

The following methods are available in this class

void GetTags (EventHandler< EventArgsWithStringArray > callback)

Get all tags assigned to the user.
Note: Tags are case sensitive, High Value and high value are different tags.

Usage

PyzePersonalizationIntelligence.GetTags((obj) =>
{
});

bool IsTagSet (string tag)

Returns true if requested tag is assigned to user.
Note: Tags are case sensitive, High Value and high value are different tags

Usage

PyzePersonalizationIntelligence.IsTagSet("tag1");

bool AreAnyTagsSet (string[] listOfTags)

Returns true if at least one tag is assigned.
Note: Tags are case sensitive, High Value and high value are different tags.

NSString[] tags = { new NSString("tag1"),new NSString("tag2"),new NSString("tag2") };
PyzePersonalizationIntelligence.AreAnyTagsSet(tags);

bool AreAllTagsSet (string[] listOfTags)

Returns true if all tags requested are assigned to user.
Note: Tags are case sensitive, High Value and high value are different tags.

NSString[] tags = { new NSString("tag1"),new NSString("tag2"),new NSString("tag2") };
PyzePersonalizationIntelligence.AreAllTagsSet(tags);

Android - Xamarin

Install & Initialize

Get Pyze App Keys

Get a Pyze App Key (PAK) for iOS and Android Xamarin apps from growth.pyze.com expand all sections collapse all sections

1. Login to growth.pyze.com

Every app is uniquely assigned a Pyze App Key (PAK), a 22 character app specific key, which you obtain from growth.pyze.com after logging in with your email and password. If you have not signed up for Pyze, you can Get Pyze here first.

Login to growth.pyze.com

2. Add a new app

Click on the Add App button on top right corner and provide the details for your app, including name, platform and optional URL for the app store. Specify the timezone where you are located.

3. Copy Pyze App Key from newly added app

Hover over the newly added app with rotating Pyze logo and copy the Pyze App Key (jUiix5alQ7KYSlG6ZQ_TXw in this example). Alternatively, you click on the “App Profile” icon and copy the PAK from the App profile page.

Alternatively, you click on the “App Profile” icon and copy the PAK from the App profile page.

Install Pyze Xamarin Package

  1. Download Pyze Xamarin Android Binding Download Pyze-Xamarin-Android.dll from here

  2. Add the PyzeXamarinAndroid.dll under .Droid -> References

  3. Right click on References -> Edit References -> .Net Assembly -> Browse the dll -> Ok

Congratulations, your Xamarin Android project now has the Pyze SDK.

Initialize

Pyze Xamarin App SDK: Setup & Initialize

The instructions on this page assume you have installed the Pyze SDK into your Xamarin project. If not, Install the SDK and come back to this page. See Getting Started Xamarin Guide.

Modify the Android Manifest

Add following tag under application tag of the manifest:

<meta-data android:name="PyzeAppKey" android:value="Use PyzeAppKey from growth.pyze.com" />

Ensure that the following Permissions are specified in the manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Modify the Main Activity of Your Project

Add the following import statement in the Main Activity:

using pyze.xamarin.android;

Add the following Pyze.initialize statement in the Main Activity’s onCreate method:

public void onCreate(Bundle savedInstanceState) {
    //
    //
    //...
       Pyze.initialize(this);

    // Alternatively you can pass the log throttling setting as the second parameter.
    // Ex: Pyze.Initialize(this, PyzeLogLevel.All);
}
Build and Go!

Add Events

Pyze Xamarin App SDK - Events

See a detailed Events Overview at api & events.

Curated Event Handling

Pyze has made it easy for you to capture events. We support many built-in events (see api).

For example, to send a custom “postAdRequested event” use:

using pyze.xamarin.android.PyzeEvents;
    ...
    ...
var customAttributes = new Dictionary();

customAttributes.Add("device", "Samsung Galaxy S6");
customAttributes.Add("power user index", "7.5");
customAttributes.Add("interests", "traveling");

PyzeAd.PostAdRequested("Google", "home", "(320, 160)", "banner", customAttributes);

Custom Event Handling

We also support custom events in addition to built in events. See custom events class api for Xamarin.

For example, to send a Pyze Custom Event without attributes, use:

using pyze.xamarin.android.PyzeEvents;
    ...
    ...
  PyzeCustomEvent.PostCustomEvent("Blog Read");

For example, to send a custom event with attributes, use:

using pyze.xamarin.android.PyzeEvents;
    ...
    ...
var  attributes = new Dictionary();
attributes.Add("screen", "Home");
attributes.Add("seconds spent", "50");

PyzeCustomEvent.PostCustomEventsWithAttributes("Blog Read", attributes);

Enable Mobile Marketing

Pyze Xamarin App SDK - Push Notifications (Android)

Turn on Push Notifications in your App project

  1. Create a new Android project at https://console.firebase.google.com/ and download the google-services.json.

  2. Add the below string resouces, with values extracted from google-services.json to the Resources -> values file, if values file is not present then please create one.

     //values of string resources here represent, key path to get the values from google-services.json
    
     <string name="default_web_client_id" translatable="false"> client ->oauth_client ->client_id </string>
     <string name="firebase_database_url" translatable="false"> project_info ->firebase_url </string>
     <string name="gcm_defaultSenderId" translatable="false"> project_info ->project_number </string>
     <string name="google_api_key" translatable="false"> client ->api_key ->current_key </string>
     <string name="google_app_id" translatable="false"> client ->client_info ->mobilesdk_app_id </string>
     <string name="google_crash_reporting_api_key" translatable="false"> client ->api_key ->current_key </string>
     <string name="google_storage_bucket" translatable="false"> project_info ->storage_bucket </string>
    
  3. Make sure that you are using the same package name in firebase and your Xamarin project.
  4. Add the following entries to you AndroidManifest.xml file. Be sure to replace the two instances of “My_Package_Name” below with your App’s package name:

     <activity android:name="com.pyze.android.push.PyzePushTrackingActivity" android:exported="true"/>
     <service android:name="com.pyze.android.push.fcm.FcmPushListenerService">
     <intent-filter>
       <action android:name="com.google.firebase.MESSAGING_EVENT" />
     </intent-filter>
     </service>
     <service android:name="com.pyze.android.push.fcm.FcmInstanceIDListenerService" android:exported="false">
     <intent-filter>
       <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
     </intent-filter>
     </service>
     <provider android:name="com.google.firebase.provider.FirebaseInitProvider"
      android:authorities="My_Package_Name.firebaseinitprovider"
      android:exported="false"
      android:initOrder="100" />
     <service android:name="com.google.firebase.iid.FirebaseInstanceIdService" android:exported="true" >
     <intent-filter android:priority="-500" >
       <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
     </intent-filter>
     </service>
     <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
      android:exported="true"
      android:permission="com.google.android.c2dm.permission.SEND" >
     <intent-filter>
       <action android:name="com.google.android.c2dm.intent.RECEIVE" />
       <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
       <category android:name="My_Package_Name" />
     </intent-filter>
     </receiver>
     <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
     <service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="true" >
     <intent-filter android:priority="-500" >
       <action android:name="com.google.firebase.MESSAGING_EVENT" />
     </intent-filter>
     </service>
    

In-App Notifications

Enable In-app Notifications in your App

In-app notifications allow app publishers to reach out to app users when they use your app. In-App Notifications are deeply integrated in Pyze Growth Intelligence and allow app publishers to reach out to users from manually from Dynamic Funnels and Intelligence Explorer, and automatically based on workflows and campaigns from Growth Automation.

App publishers have full control over when to display the in-app messages and have two options: use the user interface provided by Pyze or develop their own.

Option 1. Use Pyze provided user interface
Invoke built-in User Interface from your app

You can look for In-App messages and invoke the built-in UI anywhere in your app. For example, on a button click or in your Start method or when new scene is loaded/unloaded.

Invoke UI from your app

* Call the following method, whenever you want to show notification with default pyze UI. Method accepts a callback handler method which will be invoked whenever any of the call to action button on the UI is pressed.

```
Pyze.ShowInAppMessage(this, (sender, e) =>
{
    //On in app button pressed
});
```

Or call the following method to customize the look and feel of the In-App Message Navigation Bar buttons, and show Read, Unread or Both messages. Upto twenty previously read messages are cached, so your users can view them using the PyzeInAppTypeUnread, PyzeInAppTypeRead or PyzeInAppTypeAll enumerations.

```
Pyze.ShowInAppWithCustomOptions(this, InAppMessgeType.All, "#FFF000", (sender, e) =>
{
    //On in app button pressed
});
```
Option 2. Build your own user interface

You can provide your own user interface for in-app messages using the base level APIs

  • Get Count of New and Unfetched In-App Messages

    To get the count of new and un-fetched in-app messages you can call the following method.

     Pyze.GetUnreadMessageCount((sender, e) => {
                         //e.Value
     });
    
  • Get Message Headers

    To get the message headers call the following method. Upto 20 messages are cached within the SDK. Using PyzeInAppMessageType you can fetch new unfetched messages, or previously fetched and cached in-app messages or you can get all messages.

     Pyze.GetMessageHeaderForType(InAppMessgeType.All, (sender, e) =>
     {
     //e.Value
     });
    
  • Get Message Body

    To get the message body call the following method with details of the messageHeaders

     Pyze.GetMessageWithMessageId("cid", "mid", (sender, e) =>
     {
         //e.Value
     });
    
  • Implement handler for button clicks

    To display all unread messages

     //Get the unread message count
     Pyze.GetUnreadMessageCount((sender, e) =>
     {
     	//If there are any unread messages
     	if (e.Value > 0)
     	{
     		//Get the message headers
     		Pyze.GetMessageHeaderForType(InAppMessgeType.Unread, (sender1, e1) =>
     		{
     			// e1.Value has the has details about the unread messages
     		});
     	}
     });
    

Sending In-App notifications from growth.pyze.com

In-app notifications allow app publishers to reach out to app users when they use your app. In-App Notifications are deeply integrated in growth.pyze.com and allow app publishers to reach out to users from manually from Dynamic Funnels and Intelligence Explorer, and automatically based on workflows and campaigns from Growth Automation. For illustration purposes, we will send In-App Notifications from Dynamic Funnels.

  • Sending In-App notifications from Dynamic Funnels

    Create an event sequence, specify filters. You can reach out from either Dynamic Funnels or from Recent Sequences

    Create and send an In-app Notification. In this example, we will inform users of a tour we created for users

    View progress in Campaign History

Enable Personalization

Personalization

Enable Personalization in your App

To learn more about personalization see here.

In Intelligence explorer, for example, you may assign “High Value” tag to users who match the following criteria. This tag will be available in your app to personalize content feed, experience, user interface or messaging.

  • High Engagement and High Loyalty or
  • High Advocacy and Seasonal Ticket Holder or
  • High Revenue or
  • High Engagement, High Advocacy, and Low or Medium Attrition Risk or

The Personalization Intelligence™ tags assigned to a user are available in the agent and are accessible via class PyzePersonalizationIntelligence

The following methods are available in this class

void GetTags (EventHandler< EventArgsWithStringArray > callback)

Get all tags assigned to the user.
Note: Tags are case sensitive, High Value and high value are different tags.

Usage

PyzePersonalizationIntelligence.GetTags((sender, e) =>
{
  //e.Value contains comma seperated tag names
});
bool IsTagSet (string tag)

Returns true if requested tag is assigned to user.
Note: Tags are case sensitive, High Value and high value are different tags

Usage

PyzePersonalizationIntelligence.IsTagSet("tag1");
bool AreAnyTagsSet (string[] listOfTags)

Returns true if at least one tag is assigned.
Note: Tags are case sensitive, High Value and high value are different tags.

string[] tags = {"tag1","tag2","tag3" };
PyzePersonalizationIntelligence.AreAnyTagsSet(tags);
bool AreAllTagsSet (string[] listOfTags)

Returns true if all tags requested are assigned to user.
Note: Tags are case sensitive, High Value and high value are different tags.

string[] tags = {"tag1","tag2","tag3" };
PyzePersonalizationIntelligence.AreAllTagsSet(tags);