Getting Started
Learn more about installing the Pyze Unity 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
See instructions to get one or more Pyze App Keys depending on platforms (iOS and/or Android) you support for your Unity app.
2. Install the Pyze SDK
Install the Pyze Unity package
3. Setup & Initialize
Setup & Initialize Pyze in your Unity app
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.
- Enable Push Notifications and use Pyze as a provider for both Apple Push Notification Service (APNS) and Google Cloud Messaging (GCM). Instructions for iOS Push Notifications for Unity iOS and Instructions for Android Push Notifications for Unity Android.
- Enable Pyze In-App Notifications for Unity .
- Enable Personalization Intelligence™ for Unity .
App SDK API, Samples, Resources for Unity developers
Setup & Initialize
Get Pyze App Keys
Get a Pyze App Key (PAK) for iOS and Android Unity apps from growth.pyze.com
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
- To add an application to the Pyze platform, begin by selecting Settings from the Navigation Pane.
- Under the Apps Tab, click the Add App+ button at the top right of the window.
- Enter the App Name and Appstore URL (if available), Platform (iOS, Android, Web/SaaS, tvOS, watchOS) and select your Timezone.

- Copy Pyze App Key from your newly added app
3. Copy Your Pyze App Key
Once you add your new app, refresh the page. Navigate to your newly added app’s settings by selecting the app from the drop-down list. The Pyze App Key will be displayed below to the right (DmPTFdslRjObk1-ZlXQDVQ in this example). Copy Pyze App Key.

Pyze Unity App SDK
Install Pyze Unity Package
-
Download Pyze Unity Package
-
Verify iOS and Android modules are installed in your Unity Installation
Verify under File > Build Settings
-
Import Pyze unity package in your Unity project
Import Pyze Unity Package into your Unity project, from your
Downloads
folder by selecting Assets, Import and Custom Package…. A Pyze Menu would be added.Congratulations, your Unity project now has the Pyze SDK.
Pyze Unity App SDK: Setup & Initialize
The instructions on this page assume you have installed the Pyze SDK into your Unity project. If not, Install the SDK and come back to this page. See Getting Started Unity Guide.
Setup
After importing Pyze Unity package, you will notice the Pyze menu. Select the Initialize Pyze option and enter your Pyze App Keys for android and/or iOS platforms and select desired log level. Usually PyzeLogLevelMinimal.

Ensure you have set the Android Minimum Api Level to 15 or higher and given a unique bundle id.

Click on Save and you are done!
Alternate manual setup
If you do not want to use, or can not use the Pyze plugin for Unity, you can make the following steps manually.
iOS
Modify the PyzeAppController.mm
file present in the, Plugin/iOS/ folder and replace the Pyze App Key with your own key and set the logThrottling attribute to desired LogLevel. If you already have an AppController, merge the two controllers accordingly.
For iOS and tvOS, add code in willFinishLaunchingWithOptions and NOT didFinishLaunchingWithOptions. Also see iOS App Lifecycle Deconstructed to understand your app’s lifecycle
#import "UnityAppController.h"
@import Pyze;
@interface PyzeAppController : UnityAppController {}
@end
@implementation PyzeAppController
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Pyze initialize:@"Add your iOS Pyze App Key Here" withLogThrottling:PyzelogLevelMinimal];
[super application:application willFinishLaunchingWithOptions:launchOptions];
return YES;
}
@end
IMPL_APP_CONTROLLER_SUBCLASS( PyzeAppController )
Note: For iOS generated build, -ObjC linker flag will automatically be added to your project.
Android
//Import the PyzeUnity Package
Using PyzeUnity;
//Make sure to call Pyze.initialize api, before calling any other Pyze api
void Start(){
Pyze.Initialize ("PYZE_APP_KEY",PyzeLogLevel.PyzelogLevelMinimal);
}
//Also make sure, Inside Player Setting
, Internet Access
is set to require
Build and Go!
Events
Pyze Unity App SDK - Events
See a detailed Events Overview at api & events.
You can access the all pyze events classes from pyze.unity namespace
Custom 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 “Game End event” use:
using PyzeUnity; //Import the PyzeUnity package
...
...
Dictionary<string, object> customAttributes = new Dictionary<string, object>();
customAttributes.Add("First Name","John");
customAttributes.Add("Last Name","Smith");
customAttributes.Add("Age",25);
Pyze.PyzeEvents.Ad.PostAdRequested(
"AdMob", // AdNetwork
"Settings", // App Screen
"300x50", // Ad SIze
"Banner", // Type
customAttributes
);
Curated Event Handling
We also support custom events in addition to built in events. See custom events class api for Unity.
For example, to send a custom “Game End event” use:
using PyzeUnity; //Import the PyzeUnity package
...
...
Dictionary<string, object> customAttributes = new Dictionary<string, object>();
customAttributes.Add("Seconds Played",33.33);
customAttributes.Add("Bulletes Fired",300);
customAttributes.Add("Enemy Killed",25);
Pyze.PyzeEvents.PostCustomEventWithAttributes("Game End", customAttributes);
Enable Mobile Marketing
Push Notifications (Unity - 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
- If you do not have a valid developer account, enroll in the program here (or click on Program at developer.apple.com)
- If you have a valid developer account, login to the Apple Developer Account (or click on Account at developer.apple.com)
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.



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
- Click Settings from the Navigation Pane
- Select the app you want to provide keys for from the drop down list

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

- Select daily and weekly quota limits
- Click Save
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 Xcode Project
You can either turn Remote Notifications on either from the Xcode UI or by editing the app’s property list (usually Info.plist) file depending on you preference.
Option 1: Using Xcode UI
- In Xcode, choose View > Navigators > Show Project Navigator, or press ⌘1.
- Select your target under the TARGET heading and then select the Capabilities tab
- Open Background Modes, turn on slider to enable Background Modes then turn on Remote Notifications by clicking on the corresponding check mark.

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.
We will modify the generated app delegate UnityAppController.mm in following subsections.
Register For Remote Notifications
-
Objective-C in Unity Project
After generating a build for iOS, add following code in your generated app delegate UnityAppController.mm file’s
application: didFinishLaunchingWithOptions
: method.if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) { // iOS 8.x and tvOS 9.x onwards UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); UIUserNotificationSettings *userNotificationSettings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil]; application registerUserNotificationSettings:userNotificationSettings]; [application registerForRemoteNotifications]; } else { // Fallback for versions earlier than iOS 8.x UIRemoteNotificationType remoteNotificationTypes = (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound); [application registerForRemoteNotificationTypes:remoteNotificationTypes]; }
Let Pyze know the APNS device token
-
Objective-C in Unity Project
After generating a build for iOS, add following code in your generated app delegate UnityAppController.mm file’s
application: didRegisterForRemoteNotificationsWithDeviceToken
: method.-(void) application: (UIApplication *) application didRegisterForRemoteNotificationsWithDeviceToken: (NSData *) deviceToken { [Pyze setRemoteNotificationDeviceToken:deviceToken]; }
Let Pyze process Remote Notifications
-
Objective-C in Unity Project
After generating a build for iOS, add following code in your generated app delegate UnityAppController.mm file’s
application: didReceiveRemoteNotification
: ORapplication: didReceiveRemoteNotification
: fetchCompletionHandler: methods.//EITHER -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [Pyze processReceivedRemoteNotification:userInfo]; } //OR (recommended for background fetch) -(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { [Pyze processReceivedRemoteNotification:userInfo]; }
OR
Enable your app for Interactive Push Notifications (Available iOS 8 and above)
Defining the notification categories and register for remote notification
-
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([UNUserNotificationCenter instancesRespondToSelector:@selector(requestAuthorizationWithOptions:completionHandler:)]) { [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { //If the app make use of default notification categories provided by Pyze, call 'getPyzeDefaultNotificationCategories' method to get the categories and set it. // You can also include the custom categories defined along with these, if any. NSSet *pyzeDefaultCategorySet = [PyzeNotification getPyzeDefaultNotificationCategories]; [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:pyzeDefaultCategorySet]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } }]; } else if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) { UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); // If the app make use of default notification categories provided by Pyze, call 'getPyzeDefaultNotificationCategories' method to get the categories and set it. // You can also include the custom categories defined along with these, if any. NSSet *categories = [PyzeNotification getPyzeDefaultNotificationCategories]; UIUserNotificationSettings *userNotificationSettings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:categories]; [application registerUserNotificationSettings:userNotificationSettings]; [application registerForRemoteNotifications]; } return YES; }
Let Pyze know the APNS device token
-
Objective-C
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [Pyze setRemoteNotificationDeviceToken:deviceToken]; }
Handle/Parse the received actionable notification
-
Objective-C
For iOS 10 and above
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler { // Call below Pyze SDK method in order to handle the selected notification action by Pyze SDK. [PyzeNotification handlePushNotificationResponseWithUserinfo:response.notification.request.content.userInfo actionIdentifier:response.actionIdentifier]; /* OR // Call below Pyze SDK method to get the notification payload parsed as a 'PyzeNotificationContent' object and proceed further. [PyzeNotification parsePushNotificatoinResponseWithUserinfo:response.notification.request.content.userInfo actionIdentifier:response.actionIdentifier completionHandler:^(PyzeNotificationContent *pyzePushObject) { if (pyzePushObject) { NSLog(@"\n\n******************************************************"); NSLog(@"******************************************************"); NSLog(@"*** Pyze Push Notification Objsect ***"); NSLog(@"******************************************************\n"); NSLog(@"Title : %@", pyzePushObject.title); NSLog(@"SubTitle : %@", pyzePushObject.subTitle); NSLog(@"Body : %@", pyzePushObject.body); NSLog(@"MediaURL : %@", pyzePushObject.mediaURL); NSLog(@"Category : %@", pyzePushObject.categoryIdentifier); if (pyzePushObject.selectedAction) { NSLog(@"------------------------------------------------------"); NSLog(@"*** Selected Action ***"); NSLog(@"Selected Action name : %@\n",pyzePushObject.selectedAction.buttonName); NSLog(@"Selected Action identifier : %@",pyzePushObject.selectedAction.buttonActionIdentifier); NSLog(@"Selected Action type : %@",pyzePushObject.selectedAction.buttonActionTypeString); NSLog(@"WebPageURL : %@",pyzePushObject.selectedAction.webPageURL); NSLog(@"DeepLinkURL : %@",pyzePushObject.selectedAction.deepLinkURL); NSLog(@"ShareText : %@",pyzePushObject.selectedAction.shareText); NSLog(@"------------------------------------------------------"); } NSLog(@"All actions : %@",pyzePushObject.allActions); NSLog(@"******************************************************"); NSLog(@"******************************************************\n\n"); } }]; */ completionHandler(); } -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { completionHandler(UNNotificationPresentationOptionAlert); }
For iOS 8 and 9
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { // Call below Pyze SDK method to get the notification payload parsed as a 'PyzeNotificationContent' object and proceed further. [PyzeNotification parsePushNotificatoinResponseWithUserinfo:userInfo completionHandler:^(PyzeNotificationContent *pyzePushObject) { if (pyzePushObject) { NSLog(@"\n\n******************************************************"); NSLog(@"******************************************************"); NSLog(@"*** Pyze Push Notification Objsect ***"); NSLog(@"******************************************************\n"); NSLog(@"Title : %@", pyzePushObject.title); NSLog(@"SubTitle : %@", pyzePushObject.subTitle); NSLog(@"Body : %@", pyzePushObject.body); NSLog(@"MediaURL : %@", pyzePushObject.mediaURL); NSLog(@"Category : %@", pyzePushObject.categoryIdentifier); if (pyzePushObject.selectedAction) { NSLog(@"------------------------------------------------------"); NSLog(@"*** Selected Action ***"); NSLog(@"Selected Action name : %@\n",pyzePushObject.selectedAction.buttonName); NSLog(@"Selected Action identifier : %@",pyzePushObject.selectedAction.buttonActionIdentifier); NSLog(@"Selected Action type : %@",pyzePushObject.selectedAction.buttonActionTypeString); NSLog(@"WebPageURL : %@",pyzePushObject.selectedAction.webPageURL); NSLog(@"DeepLinkURL : %@",pyzePushObject.selectedAction.deepLinkURL); NSLog(@"ShareText : %@",pyzePushObject.selectedAction.shareText); NSLog(@"------------------------------------------------------"); } NSLog(@"All actions : %@",pyzePushObject.allActions); NSLog(@"******************************************************"); NSLog(@"******************************************************\n\n"); } }]; /* OR If you have any action type set for the default tap of the notification in Pyze dashboard and if you want Pyze to handle the action when app launched from push, can call "handlePushNotificationResponseWithUserinfo:actionIdentifier:" method with 'k_PyzeDefaultNotificationAction' as action identifier [PyzeNotification handlePushNotificationResponseWithUserinfo:userInfo actionIdentifier:k_PyzeDefaultNotificationAction]; */ } -(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(nonnull NSDictionary *)userInfo completionHandler:(nonnull void (^)())completionHandler { // Call below Pyze SDK method in order to handle the selected notification action by Pyze SDK. [PyzeNotification handlePushNotificationResponseWithUserinfo:userInfo actionIdentifier:identifier]; /* OR // Call below Pyze SDK method to get the notification payload parsed as a 'PyzeNotificationContent' object and proceed further. [PyzeNotification parsePushNotificatoinResponseWithUserinfo:userInfo actionIdentifier:identifier completionHandler:^(PyzeNotificationContent *pyzePushObject) { if (pyzePushObject) { NSLog(@"\n\n******************************************************"); NSLog(@"******************************************************"); NSLog(@"*** Pyze Push Notification Object ***"); NSLog(@"******************************************************\n"); NSLog(@"Title : %@", pyzePushObject.title); NSLog(@"SubTitle : %@", pyzePushObject.subTitle); NSLog(@"Body : %@", pyzePushObject.body); NSLog(@"MediaURL : %@", pyzePushObject.mediaURL); NSLog(@"Category : %@", pyzePushObject.categoryIdentifier); if (pyzePushObject.selectedAction) { NSLog(@"------------------------------------------------------"); NSLog(@"*** Selected Action ***"); NSLog(@"Selected Action name : %@\n",pyzePushObject.selectedAction.buttonName); NSLog(@"Selected Action identifier : %@",pyzePushObject.selectedAction.buttonActionIdentifier); NSLog(@"Selected Action type : %@",pyzePushObject.selectedAction.buttonActionTypeString); NSLog(@"WebPageURL : %@",pyzePushObject.selectedAction.webPageURL); NSLog(@"DeepLinkURL : %@",pyzePushObject.selectedAction.deepLinkURL); NSLog(@"ShareText : %@",pyzePushObject.selectedAction.shareText); NSLog(@"------------------------------------------------------"); } NSLog(@"All actions : %@",pyzePushObject.allActions); NSLog(@"******************************************************"); NSLog(@"******************************************************\n\n"); } }]; */ completionHandler(); }
8.Enable your app for Rich Push Notifications
-
Add New Target by clicking ‘+’ sign in the Xcode project targets section
-
Select Notification Service Extension and click ‘Next’
- Give a name for the extension and click ‘Finish’
-
Select ‘Activate’ button in Activate “NotificationServiceExtension” scheme? Dialog
- Enable ‘Push Notifications’ in ‘Capabilities’ section for both app and extension targets.
-
Also enable ‘Remote notifications’ and ‘Background fetch’ in ‘Capabilities’ section for the application target.
-
Enable ‘Push Notifications’ in ‘Capabilities’ section for service extension target.
- Create a Rich Push profile associate with your app’s certificates in iTunes Connect
- Install the created Rich push profile and set the respective bundle identifier to the extension bundle.
To use the Service extension utility class provided by Pyze, follow the below mentioned steps:
Integrate service extension utility
a. Manual integration:
- Download the PyzeAppExtensions from here
-
Drag and drop the PyzeAppExtensions.xcodeproj into your project
- Select notification service extension target. Navigate to General -> Linked Frameworks and Libraries. Click on ‘+’ icon
-
Select PyzeAppExtensions.framework
b. Cocoapods integration:
* Create a pod file using 'pod init' command
* Under Notification service extension target in pod file add following line: **pod ‘pyze-iOS-extensions'**
<figure><img class="docimage" src="images/unity/addExtensionPodName.png" alt="" /></figure>
* Run '**pod install**' command
Open “.h” of default notification service extension class created by Xcode.
* Import **PyzeNotificationServiceExtension.h** and set **PyzeNotificationServiceExtension** as super class of your notification service class.
<figure><img class="docimage" src="images/unity/subclassNotificationUtility.png" alt="" /></figure>
Open “.m” of default notification service extension class created by Xcode
* Remove all pre-written callback methods
<figure><img class="docimage" src="images/unity/deletePreWrittenCode.png" alt="" /></figure>
Pyze Unity App SDK - Push Notifications (Android)
Google Notifications
Google provides the Firebase Cloud Messaging service (FCM) to allow app publishers to reach out to their users via push notifications.
App Publishers have the option of hosting and running servers “app servers” themselves to send notification content “payload” to FCM. Google then forwards the notification content to your app on user’s device.
Pyze customers do not have to maintain their own servers to communicate with Google’s Messaging service. Pyze can be used to send push notifications for an app in development, an app that is live in Google Play, and to a combination of apps in development and production.

Prerequisites
You must Create Firebase project in Firebase console. Click here after logging into the google account that owns your project for next steps.
Following sections
In the following sections, we will generate the google-services.json and enter the Server Key in growth.pyze.com. Then we will also enable push notifications in your Android project.
Configuring the Server API Key and Sender ID
In this section we will
- Get the Server Key and Sender ID for your app
- Enter the Server Key on growth.pyze.com
Generate the Server API Key and Sender ID
Login into the Google Account that owns your app
Go to Google Cloud Messaging and select Get a Configuration File
- Obtain the Server API Key and Sender ID from the project settings for your



Enter the Server Key and Sender ID on growth.pyze.com
Login into your Firebase Console
- Select Your Project and Click on the Settings icon next to the Project name
- In the Cloud Messagin Tab, locate the Server Key and Sender ID

Login into your Pyze Account
- On the Settings page, select an app from the drop down menu.
- On the App Settings page, navigate to the Push Notifications settings from the left pane.
- Enter the Server key and Sender ID along with quota limits for the maximum number of push messages your app can send in a day and a week.

Turn on Push Notifications in your App project
-
Create a new Android project at https://console.firebase.google.com/ and download the google-services.json.
-
Place the google-services.json file into Assets folder of your Unity project.
- Make sure that you are using the same bundle identifier in firebase and your unity project.
-
Under the “Pyze” Menu option select, “Enable Push Notification for Android”.
-
Paste the code displayed in the window inside the
tag of your manifest file. - To specify custom notification icon image, you need to place two icon images in Assets/Plugins/Android/res/drawable/ folder by name “pyze_notification_icon” and “pyze_notification_icon_transperent”.
- Pyze also supports Rich Push Notifications. You can send images and add custom buttons in your push notifications and increase mobile engagement.
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.
void ShowInAppMessagesWithDefaultUI(EventHandler callback);
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.
void ShowInAppWithCustomOptions( PyzeInAppMessageType messageType, UnityEngine.Color buttonTextcolor, UnityEngine.Color buttonBackgroundColor, UnityEngine.Color backgroundColor, UnityEngine.Color messageCounterTextColor, EventHandler callback );
-
Call the following method, whenever you want to get the unread message count from server.
void CountNewUnFetchedMessages(EventHandler callback);
-
To get notified which button the app user clicked on along with the deep link status, implement a handler for the call-to-action buttons.
Pyze.PyzeEvents.InAppMessages.CountNewUnFetchedMessages((sender, e) => { if(Int32.Parse (e.Value) > 0){ Pyze.PyzeEvents.InAppMessages.ShowInAppMessagesWithDefaultUI((sender, e) => { //Handle Button Click Debug.Log("Button Clicked: " + e.ButtonId + " Title: " + e.Title + " Status: " + e.Status + " Url: " + e.UrlInfo + " Message Id: " + e.mId + " Campaign Id: " + e.cId ); }); } });
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.
void CountNewUnFetchedMessages(EventHandler<EventArgsWithString> callback);
-
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.
void GetMessageHeaderOfType( PyzeInAppMessageType messageType, <EventArgsWithDictionaryArray> callback ); enum PyzeInAppMessageType{ PyzeInAppTypeUnread, PyzeInAppTypeRead, PyzeInAppTypeAll }
-
Get Message Body
To get the message body call the following method with details of the messageHeaders
void GetMessageWithContentID( string contentId, string messageId, EventHandler<EventArgsWithInAppObject> callback );
-
Implement handler for button clicks
To display all unread messages
Pyze.PyzeEvents.InAppMessages.CountNewUnFetchedMessages((sender, e) => { if(Int32.Parse (e.Value) > 0){ Pyze.PyzeEvents.InAppMessages.GetMessageHeaderOfType( PyzeInAppMessageType.PyzeInAppTypeAll,(sender, e) => { if(e.Value != null){ foreach (var item in e.Value) { Pyze.PyzeEvents.InAppMessages.GetMessageWithContentID( item["cid"], item["mid"], (sender1, e1) => { Debug.Log("Button Clicked. Title: " + e1.Value.title + ", Message: " + e1.Value.message + ", Template: " + e1.Value.templateId + ", Title Color: " + e1.Value.templateData.titleColor + ", Message Color: " + e1.Value.templateData.messageColor); }); foreach (var button in e1.Value.templateData.buttons) { foreach (var attribute in button.atrributes) { Debug.Log(attribute); } } }); } } }); } });
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 Conversion Funnels and Auto Segmentation, and automatically based on workflows and campaigns from Growth Automation. For illustration purposes, we will send In-App Notifications from Conversion Funnels.
-
Sending In-App notifications from Conversion Funnels
Create an event sequence and specify filters. You can reach out from either Build & Run or from Saved Funnels.
Create and send an In-App Notification. In this example, we will congratulate the user for reaching a milestone with a reward.
Enable Personalization
Personalization Intelligence™
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
Pyze.PyzePersonalizationIntelligence.GetTags((sender, e) => {
foreach (var tag in e.Value) {
Debug.Log(tag);
}
});
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
Debug.Log(Pyze.PyzePersonalizationIntelligence.IsTagSet ("loyal"));
});
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.
Usage
Pyze.PyzePersonalizationIntelligence.AreAnyTagsSet (new string[]{"loyal","High Value","high value" });
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.
Usage
Pyze.PyzePersonalizationIntelligence.AreAllTagsSet (new string[]{"loyal","High Value","high value" });
Additional notes:
If you are using gradle build system inside unity. Please kindly add the following lines inside your custom progaurd file.
-keep class com.pyze.android.** {*;}
-keep class com.pyze.android.pyzeunitybridge.** {*;}
User Privacy
Pyze provides APIs to allow end-users to Opt out of Data Collection and also instruct the Pyze system to forget a user’s data.
setUserOptOut
Allows end-users to opt out from data collection. Opt-out can be toggled true or false.
Pyze.setUserOptOut(true)
To resume user data collection set value to false
Pyze.setUserOptOut(false)
deleteUser
Allows end-users to opt out from data collection and delete the user in the Pyze system. We recommend you confirm this action as once a user is deleted, this cannot be undone.
Pyze.deleteUser(true)