Getting Started

Apache Cordova lets HTML5, CSS3, and JavaScript developers build native mobile apps for iOS and Android. Learn more about installing the Pyze Apache Cordova Smart SDK, initializing it, using events, and setting up In-app and/or push notifications. The Pyze SDK supports Android versions 4.0.3 (minSdkVersion 15) and above for Android and iOS version 8 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 Apache Cordova app.

2. Install the Pyze SDK

Install the Pyze Apache Cordova package

3. Setup & Initialize

Setup & Initialize Pyze in your Apache Cordova 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

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

Add Events to your Apache Cordova app.

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 Apache Cordova developers

Apache Cordova API

Setup & Initialize

Get Pyze App Keys

Get a Pyze App Key (PAK) for iOS and Android Apache Cordova apps from

1. Login to

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

Login to

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.

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 Apache Cordova App SDK

Getting Started with Apache Cordova

If you are new to Apache Cordova, see Getting Started with Apache Cordova App. Install Apache Cordova and create an iOS and/or Android app.

Installing Pyze Apache Cordova SDK

Run the following command inside your project directory.

cordova plugin add pyze-cordova --variable ANDROID_PAK=ANDROID_PYZE_APP_KEY --variable IOS_PAK=iOS_PYZE_APP_KEY

Now you are ready to Setup and Initialize for iOS and Android

Pyze Apache Cordova App SDK: Setup & Initialize

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

a. To update the ANDROID_PYZE_APP_KEY update PYZE_APP_KEY inside config.xml and AndroidManifest.xml present at platforms/android folder

b. To update the iOS_PYZE_APP_KEY update PYZE_APP_KEY inside config.xml and PROJECT_NAME-info.plist present at platforms/ios/PROJECT_NAME/ folder

Running the install command will also initialize your application

Pyze Apache Cordova App SDK: Ionic Support

  1. Use ionic cordova plugin add pyze-cordova --variable ANDROID_PAK=ANDROID_PYZE_APP_KEY --variable IOS_PAK=iOS_PYZE_APP_KEY to install and initialize Pyze SDK on Ionic platform

  2. For ionic we need window.pyze.cordova namespace to access Pyze SDK API’s rather than pyze.cordova

Build and Go!


Pyze Apache Cordova App SDK - Events

See a detailed Events Overview at api & events.

You can access the all pyze events classes from pyze.cordova namespace

Custom Event Handling

a. Post custom events

pyze.cordova.PyzeEvents.postCustomEvent("Event Name");

b. Post custom event with attributes

var customAttribute = {};
customAttribute.color = "Red";
pyze.cordova.PyzeEvents.postCustomEventWithAttributes("Event Name",customAttribute);

c. Post timed event

//Cache the timer reference 
var timerReference;
    timerReference = timerRef;

//Post the cached reference with postTimedEventWithName/postTimedEventWithName 
pyze.cordova.PyzeEvents.postTimedEventWithName("Timed Event Name",timerReferance);

Timed Events

Pyze has made it easy for you to capture duration between events. Pyze supports timed events using following API’s

  • startTimerForEvent - Use this API start timer for perticular event by passing the event name attribute.

  • postTimedEvent - Use this API to end timer and post the event with duration. This API accepts event name attribute.

  • postTimedEventWithAttributes - This is similar to postTimedEvent API, it accepts a additional attributes parameter which is of type dictionary object.

//Start timer for event
pyze.cordova.PyzeEvents.startTimerForEvent("Screen Load Time");

//Post timed event. 
//Note : The event name attribute for the `startTimerForEvent` and  `postTimedEvent` should match.
pyze.cordova.PyzeEvents.postTimedEvent("Screen Load Time");

//Post timed event with attributes
var customAttributes = {};
customAttributes["device"] = "Nokia 4.2";
customAttributes["location"] = "CA";
pyze.cordova.PyzeEvents.postTimedEventWithAttributes("Screen Load Time", customAttributes);

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 an Ad requested event, use the curated event class as shown in example below:

var customAttributes = {};
customAttributes["First Name"] = "John";
customAttributes["Last Name"] = "Smith";
customAttributes["Age"] = 25;
    "AdMob",                // AdNetwork
    "Settings",            // App Screen
    "300x50",              // Ad SIze
    "Banner",              // Type

Enable Mobile Marketing

Push Notifications (Apache Cordova - iOS)

Apple Push Notifications

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.

1. Generate Personal Information Exchange PKCS #12 (.p12)
  • Go to Certificates, Identifiers & Profiles page of your apple developer account.
  • Select Identifiers and go to YOUR_APP_IDENTIFIER.
  • Under Capabilities go to Push Notifications and select Configure
  • Now under Development/Production SSL Certificate select Create Certificate
  • Upload the Certificate Signing Request as mentioned here
  • Download the certificate generated and add to the Keychain Access
  • Now select the certificate just imported and choose Export.
  • Enter the password and save the .p12 to the desired location.
2. 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
  • 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
3. Enabling Push Notifications
  • Goto to capability under application target, add capability Push Notifications and Background Modes.
  • Under Background Modes check Remote notifications.
4. Modify AppDelegate

Update AppDelegate as shown below


@import Pyze;
#import <UserNotifications/UserNotifications.h>

@import CoreMotion;

//Let AppDelegate inherit UNUserNotificationCenterDelegate
@interface ALAppDelegate () <UNUserNotificationCenterDelegate>

@implementation ALAppDelegate

//Initialize Pyze
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Pyze initialize:@"PYZE_APP_KEY" withLogThrottling: PyzelogLevelMinimal];
    return YES;

//Register for remote notification
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert +UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) {}];
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[PyzeNotification getPyzeDefaultNotificationCategories]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
    return YES;

//Set remote notification token to Pyze
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [Pyze setRemoteNotificationDeviceToken:deviceToken];

//Notify Pyze when push received.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
    [Pyze processReceivedRemoteNotification:userInfo];

//Let pyze handle the remote notification action
-(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
    [PyzeNotification handlePushNotificationResponseWithUserinfo:response.notification.request.content.userInfo actionIdentifier:response.actionIdentifier];

//Enable app to view notification in foreground
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {


import Pyze
import UserNotifications

//Let AppDelegate inherit UNUserNotificationCenterDelegate
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {

    //Initialize Pyze
    func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        Pyze.initialize("PYZE_APP_KEY", withLogThrottling: .PyzelogLevelMinimal)
        return true

    //Register for remote notification
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        UNUserNotificationCenter.current().delegate = self;
        UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]) { granted, error in }
        UNUserNotificationCenter.current().setNotificationCategories(PyzeNotification.getPyzeDefaultNotificationCategories() as! Set<UNNotificationCategory>);
        return true

    //Set remote notification token to Pyze
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    //Notify Pyze when notification received
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

    //Let pyze handle the remote notification action
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        PyzeNotification.handlePushResponse(withUserinfo: response.notification.request.content.userInfo, actionIdentifier: response.actionIdentifier)

    //Enable app to view notification in foreground
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
5. Enable Rich Push Notification for your app.

Enable your app to receive images and gifs inside push notification messages.

  • Go to File -> New -> Target and cretea Notification Service Extension.
  • Fill the Product Name and select required language.
  • Make sure to select Embed in Application as YOUR PROJECT.
  • XCode will create a NotificationService class after adding the above extension. Replace its content by below code.
#import "NotificationService.h"

@interface NotificationService ()

@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;


@implementation NotificationService

- (NSURL *) attachmentFileURLWithTempLocation:(NSURL *)location name:(NSString *)fileName {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;
    NSArray * domainDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [domainDirectories objectAtIndex:0];
    NSString *attachmentLocalFilePath = [documentsDirectory stringByAppendingPathComponent:@"/Pyze/"];
    if(![fileManager fileExistsAtPath:attachmentLocalFilePath]) [fileManager createDirectoryAtPath:attachmentLocalFilePath withIntermediateDirectories:NO attributes:nil error:&error];
    attachmentLocalFilePath =  [attachmentLocalFilePath stringByAppendingFormat:@"/%@",fileName];
    if([fileManager fileExistsAtPath:attachmentLocalFilePath]) {
        [fileManager removeItemAtPath:attachmentLocalFilePath error:&error];
        if (error) NSLog(@"Error in removing file : %@", error.debugDescription);
    [fileManager moveItemAtPath:[location path] toPath:attachmentLocalFilePath error:&error];
    if (error) NSLog(@"Error in moving file to location : %@", error.debugDescription);
    NSURL *mediaFileURL = [NSURL fileURLWithPath:attachmentLocalFilePath];
    return mediaFileURL;

- (NSURLSessionDownloadTask *) loadAttachmentsWithURLString:(NSString *)urlString {
    NSURL *mediaURL = [NSURL URLWithString:urlString];
    NSURLSessionDownloadTask *task = [[NSURLSession sharedSession] downloadTaskWithURL:mediaURL completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) {
          if (!error) {
              NSURL *mediaFileURL = [self attachmentFileURLWithTempLocation:location name:[response suggestedFilename]];
              UNNotificationAttachment *attachment = [UNNotificationAttachment attachmentWithIdentifier:[response suggestedFilename] URL:mediaFileURL options:nil error:&error];
              if (attachment) self.bestAttemptContent.attachments = @[attachment];
    return task;

#pragma mark - UNNotificationServiceExtension delegate

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];
    self.bestAttemptContent.title = self.bestAttemptContent.title;
    self.bestAttemptContent.subtitle = self.bestAttemptContent.subtitle;
    NSString *mediaUrlString = request.content.userInfo[@"mediaUrl"];
    NSURLSessionDownloadTask *task = [self loadAttachmentsWithURLString:mediaUrlString];
    [task resume];

- (void)serviceExtensionTimeWillExpire {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.

import UserNotifications

class NotificationService: UNNotificationServiceExtension {

    var contentHandler: ((UNNotificationContent) -> Void)?
    var bestAttemptContent: UNMutableNotificationContent?

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        self.contentHandler = contentHandler
        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
        defer {
            contentHandler(bestAttemptContent ?? request.content)
        guard let attachment = request.attachment else { return }
        bestAttemptContent?.attachments = [attachment]
    override func serviceExtensionTimeWillExpire() {
        // Called just before the extension will be terminated by the system.
        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
        if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {

extension UNNotificationRequest {
    var attachment: UNNotificationAttachment? {
        guard let attachmentURL = content.userInfo["mediaUrl"] as? String, let imageData = try? Data(contentsOf: URL(string: attachmentURL)!) else {
            return nil
        return try? UNNotificationAttachment(data: imageData, options: nil)

extension UNNotificationAttachment {
    convenience init(data: Data, options: [NSObject: AnyObject]?) throws {
        let fileManager = FileManager.default
        let temporaryFolderName = ProcessInfo.processInfo.globallyUniqueString
        let temporaryFolderURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(temporaryFolderName, isDirectory: true)
        try fileManager.createDirectory(at: temporaryFolderURL, withIntermediateDirectories: true, attributes: nil)
        let imageFileIdentifier = UUID().uuidString + ".jpg"
        let fileURL = temporaryFolderURL.appendingPathComponent(imageFileIdentifier)
        try data.write(to: fileURL)
        try self.init(identifier: imageFileIdentifier, url: fileURL, options: options)

Push Notifications with FCM

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.


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 Then we will also enable push notifications in your Android project.

Configuring the Server API Key and Sender ID

In this section we will

  1. Get the Server Key and Sender ID for your app
  2. Enter the Server Key on
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
Login into your Firebase Console
  1. Select Your Project and Click on the Settings icon next to the Project name
  2. In the Cloud Messagin Tab, locate the Server Key and Sender ID
Login into your Pyze Account
  1. On the Settings page, select an app from the drop down menu.
  2. On the App Settings page, navigate to the Push Notifications settings from the left pane.
  3. 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.
Integrate FCM Push Notifications in your App project
  1. First, add rules to your root-level build.gradle file, to include the google-services plugin:

     buildscript {
         // ...
         dependencies {
             // ...
             classpath ''
  2. Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:

     apply plugin: ''
     android {
       // ...
     dependencies {
       // ...
       compile ''
     apply plugin: ''
  3. Add the below dependency to your app’s build.gradle file:

     dependencies {
         compile ""
  4. In the Android.Manifest file, add the below between the Application Tag:

     <receiver android:name="" android:exported="true"/>
             <action android:name="" />
  5. Get the configuration file from Google and place it under your app/ folder in your android studio project. Open this link for more info:

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.cordova.PyzeEvents.postCustomEvent("CTA Clicked");
  • 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 PyzeInAppMessageType enumerations like PyzeInAppTypeUnread, PyzeInAppTypeRead or PyzeInAppTypeAll .

     showInAppNotificatonWithCustomAttributes(messageType, colour, callback);


     pyze.cordova.Pyze.showInAppNotificatonWithCustomAttributes(messageType, colour, function(messageDetails){


       ("PyzeInAppTypeAll","#c9c9c9", function(param){
  • Call the following method, whenever you want to get the unread message count from server.

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


           if(message.Value > 0){
                 console.log("Button Clicked: " + messageDetails.ButtonId
                         + " Title: " + messageDetails.Title
                         + " Status: " + messageDetails.Status
                         + " Url: " + messageDetails.UrlInfo
                         + " Message Id: " + messageDetails.mId
                         + " Campaign Id: " + messageDetails.cId
  • To close the in app message use the following method



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.

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

     getMessageHeaderOfType( messageType, callback);

    Use any of the following PyzeInAppMessageType strings “PyzeInAppTypeUnread” , “PyzeInAppTypeRead” or “PyzeInAppTypeAll”

  • Get Message Body

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

     getMessageWithContentID( contentId,  messageId, callback);
  • Implement handler for button clicks

    To display all unread messages

           if(value > 0 ){
                 //Note for iOS platform below parsing from string headers to JSON is not needed.
           var jsonArray = JSON.parse(headers);
                 jsonArray.forEach(function(element) {
                 }, this);

Sending In-App notifications from

In-app notifications allow app publishers to reach out to app users when they use your app. In-App Notifications are deeply integrated in 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


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


isTagSet(tag, callback)

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


pyze.cordova.PyzePersonalizationIntelligence.isTagSet("loyal", function(tagExists) {
areAnyTagSet(listOfTags, callback)

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


pyze.cordova.PyzePersonalizationIntelligence.areAnyTagSet(["loyal","High Value","Low value"], function(tagExists) {

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


pyze.cordova.PyzePersonalizationIntelligence.areAllTagSet("loyal,High Value,Low value", function(tagExists) {

User Profiles

Pyze provides ways to segment data for each logged in user. You can use the following API’s to manage user profiles within your app.


Use this API to set user profiles.

//Create Pyze Profile Attributes object
var pyzeProfileAttributes = {
   "email_id"        : "",
   "date_of_birth"   : "1984-06-01",
   "first_name"      : "John",
   "last_name"       : "Jacobs"
//Create Custom Profile Attributes object
var customProfileAttributes = {
   "age"       : 29,
   "pincode"   : "23200",
   "city"      : "XYZ"
//Call the setUserProfile API

Following are the possible Pyze user profile attributes.

Pyze User Profile Field Name Data Type/Description
background (string) User background, biography or historical data
country (string) Country codes must be sent in the ISO-3166-1 alpha-2 standard.
current_location (object) Format: {“longitude”: -33.991894, “latitude”: 25.243732}
date_of_first_use (date at which the user first used the app) String in ISO 8601 format or in yyyy-MM-dd’T’HH:mm:ss.SSSZ format.
date_of_last_use (date at which the user last used the app) String in ISO 8601 format or in yyyy-MM-dd’T’HH:mm:ss.SSSZ format.
date_of_birth (date of birth) String in format “YYYY-MM-DD”, example: 1984-06-01.
email_id (string) Email Id
email_subscribe (string) Acceptable values are “opt_in” (explicit approval to receive email messages), “opt_out” (explicit denial to email messages), and “subscribed” (neither opted in nor out).
email_hard_bounced Automatically updated when a hard bounce occurs (true or false)
email_spam_reported Automatically updated when a user marks your email as spam, via the ISP (true or false)
facebook_id facebook ID
first_name (string) User’s First name
gender (string) “M”, “F”, “O” (other), “N” (not applicable), “P” (prefer not to say) or “U” (unknown).
home_city (string) User’s Home City
image_url (string) URL of image to be associated with the user
language (string) Require language to be sent in the ISO-639-1 standard.
last_name (string) User’s Last Name
marked_email_as_spam_at (string) Date at which the user’s email was marked as spam. Must be in ISO 8601 format or in yyyy-MM-dd’T’HH:mm:ss.SSSZ format.
phone (string) Phone number
push_subscribe (string) Available values are “opted_in” (explicitly registered to receive push messages), “unsubscribed” (explicitly opted out of push messages), and “subscribed” (neither opted in nor out).
push_tokens Array of objects with app_id and token string. You may optionally provide a device_id for the device this token is associated with, e.g., [{“app_id”: App Identifier, “token”: “abcd”, “device_id”: “optional_field_value”}]. If a device_id is not provided, one will be randomly generated.
time_zone (string) Time Zone’s must be sent as per IANA Time Zone Database (e.g., “America/New_York” or “Eastern Time (US & Canada)”). Only valid values will be respected.
twitter_id Twitter ID


To update user profile attributes which are already set, use the following api.

Note : Do not call this api before calling setUserProfile.

//Create Pyze Profile Attributes object
var pyzeProfileAttributes = {
   "email_id"        : "",
   "date_of_birth"   : "1984-07-01",
   "first_name"      : "John M",
   "last_name"       : "Jacobs"
//Create Custom Profile Attributes object
var customProfileAttributes = {
   "age"       : 29,
   "pincode"   : "232001",
   "city"      : "XYZ2"
//Call the updateUserProfileAttributes API


This API is used to reset the user. Call this when you want to remove user from the device.


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.


Allows end-users to opt out from data collection. Opt-out can be toggled true or false.


To resume user data collection set value to false



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.