FireOS Getting Started

Learn more about installing using Gradle (or manually), initializing it in your FireOS app, and optionally, using events and setting up push notifications. The Pyze SDK supports Android versions 4.0.3 (minSdkVersion 15) and above.

1.Get a Pyze App Key

See instructions to get a Pyze App Key for your new app

2. Install the Pyze SDK

automatically using Gradle or Maven (recommended) OR manually using the Pyze Jar

3. Initialize

Add initialization code to your Android app

Build and Go!

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

4. Add Events (App Events, Timed Events, Curated Events)

Optionally, add Events to your app. In addition to a rich set of event for Mobile Commerce, Drones, Bitcoin etc. available right out-of-the-box (events api), Pyze provides the ability to send custom events using the postCustomEvent method in the PyzeEvents class. Pyze Events are avilable to all apps and do not require any instrumentation.

Events Overview is available in the api & events.

5. Enable Push Notifications, In-App Notifications and Attribution

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

Install

Get Pyze App Key

Get a Pyze App Key (PAK) 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

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 with Gradle or Maven

We recommend using Gradle or Maven when installing the Pyze SDK as it is the easiest and ensures you are using the latest stable version. However, if you prefer to install the SDK manually, click here.

I want to start using Gradle with Android Studio

1. Add the Pyze Repository in the Project build.gradle file

In Android Studio, add the Pyze repository to all projects in the Project build.gradle file:

allprojects {
    repositories {
        jcenter()
        maven {
            url  "http://pyze.bintray.com/pyze-android"
        }
    }
}
2. Add the Pyze Dependency in the App build.gradle file

Add the pyze library compile statement under dependencies in the App build.gradle:

dependencies {
    compile 'com.pyze:PyzeLibrary:---Latest-Version---'

    // Usage example: compile 'com.pyze:PyzeLibrary:4.+'
}

The latest version can always be obtained from Bintray here

3. Add the PyzeAppKey obtained from growth.pyze.com in AndroidManifest.xml

Add the PyzeAppKey in the Application Tag in the AndroidManifest.xml

<meta-data android:name="PyzeAppKey" android:value="PYZE_APP_KEY"/>

I want to start using Maven with Eclipse

Add the following in your project’s pom.xml with the latest PyzeLibrary Version from Bintray here:

<dependency>
    <groupId>com.pyze</groupId>
    <artifactId>PyzeLibrary</artifactId>
    <version>4.0.0</version>
</dependency>

Items to note:

1.The Pyze SDK Support Android 4.03 and above. Ensure that your minSDKVersion is set to 15 or above:
minSdkVersion 15
2. Ensure that the following permissions are specified in AndroidManifest.xml:
<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"/>

And You’re done!

Congratulations, your project now has the Pyze SDK. Lean how to initialize the SDK.

Manual Pyze Installation Android Studio or Eclipse

We recommend installing the SDK using Gradle as it is the easiest approach and ensures you are using the latest stable version. Click here to learn more.

I want to install the SDK Manually

1. Download the latest Pyze library

Download the latest Pyze Library Jar file by clicking here or paste the below URL in your browser to download:

https://bintray.com/pyze/pyze-android/PyzeLibrary/_latestVersion

Note: If you’d like to use Maven to install the SDK

2. Place the Pyze SDK library in your project’s libs directory
3. Add the Pyze Dependency to your project

In Android Studio, add the pyze library compile statement under dependencies in the App build.gradle:

dependencies {
    compile files('libs/PyzeLibrary.jar')
}

In Eclipse, add the pyze library to the project’s java path:

4.Add the PyzeAppKey obtained from growth.pyze.com in AndroidManifest.xml

Add the PyzeAppKey in the Application Tag in the AndroidManifest.xml:

<meta-data android:name="PyzeAppKey" android:value="PYZE_APP_KEY"/>
5.Items to note:

The Pyze SDK Support Android 4.03 and above. Ensure that your minSDKVersion is set to 15 or above:end

minSdkVersion 15

Ensure that the following Pemissions are specified in the AndroidManifest.xml:

<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"/>

And You’re done!

Congratulations, your project now has the Pyze SDK. Lean how to initialize the SDK.

Initialize

Enable the Pyze SDK in your code

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

  • In the Main Activity for your project, make the following additions:

Add the following import statement in the Main Activity:

import com.pyze.android.*;
  • Add the following Pyze.initialize statement in the Main Activity’s onCreate method:
public void onCreate(Bundle savedInstanceState) {
//
//
//...
        Pyze.initialize(getApplication());
    }

Build and Go!

Add Events & Attribution

Pyze FireOS App SDK - Events

Events Overview is available in the api & events.

Curated Event Handling

Pyze has made it easy for you to capture events. We support many built-in events - see Android Events API. To enable PyzeEvents, import the PyzeEvents and HashMap classes in the activity where you’ll be capturing events and initialize events in the onCreate method of the activity before firing any events:

import com.pyze.android.PyzeEvents;
import java.util.HashMap;

//...
//...
   public void onCreate(Bundle savedInstanceState) {
//
//
//...
        Pyze.initializeEvents(getApplication());
    }

For example, to track ad request use:

import com.pyze.android.PyzeEvents;
import java.util.HashMap;

//...
//...
//    Pyze.initializeEvents(getApplication()); //Initialize in onCreate method of main activity
//
//    Definition of  postAdRequested method in PyzeAd curated class
//
//    public static void postAdRequested(
//        java.lang.String adNetwork,
//      java.lang.String appScreen,
//      java.lang.String size,
//      java.lang.String type,
//      java.util.HashMap;<String, String>;
//    Add required attributes and add


    HashMap <String, String> attributes = new HashMap<String, String>();
    attributes.put("device", "Samsung Galaxy S6");
    attributes.put("power user index", "7.5");
    attributes.put("interests", "traveling");


    PyzeEvents.PyzeAd.postAdRequested("Google", "home", "(320, 160)", "banner", attributes);

Custom Event Handling

We also support custom events in addition to built in events. See postCustomEvent method in the Pyze Events Class.

import com.pyze.android.PyzeEvents;
import java.util.HashMap;
//...
//...
//    Pyze.initializeEvents(getApplication()); //Initialize in onCreate method of main activity
//
// Custom Event without Attributes

      PyzeEvents.postCustomEvent("Blog Read");


// Custom Event with Attributes
// Create Hashmap with key value pairs of custom attributes and post with postCustomEventWithAttributes

    HashMap <String, String> attributes = new HashMap<String, String>();
    attributes.put("screen", "Home");
    attributes.put("seconds spent", "50");

     PyzeEvents.postCustomEventWithAttributes("Blog Read", attributes);

Pyze FireOS App SDK - Tracking Install Sources

Enabling Attribution Tracking

Acquisition source attribution allows for app developers to understand the sources for their app installs. Android makes the ref_id available to your app at the first launch.

The ref_id is a series of specific key / value pairs that must be included in the referring URL to Google Play. The keys you can use are

  • Campaign Source (utm_source),
  • Campaign Medium (utm_medium),
  • Campaign Term (utm_term),
  • Campaign Content (utm_content) and
  • Campaign Name (utm_name).
  • Campaign Source, Campaign Medium, and Campaign Name are required fields. You can build custom referral URLs using the URL form builder.

This is what a referring URL might look like:

http://play.google.com/details?id=your.package.name&utm_source=google&utm_medium=banner&utm_campaign=mycampaign

To enable install source tracking, add the following lines to the AndroidManifest.xml before the </application> tag:

<receiver android:name="com.pyze.android.PlayRefReceiver" android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Build and Go.

Attribution Events will automatically be captured and be available for exploration in Events and Dynamic Funnels.

Mobile Marketing

In-App Notifications

Enable In-app Notifications in your App

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

App businesses 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 either on button click, in your onLaunch method

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.

// By default this method only shows new and unread in-app notifications and does not notify a OnButtonClickListener on the status of a click
Pyze.showInAppNotificationUI(this, null);

//Code to dismiss the In-app message
public static void closeInAppMessageDialog(android.app.Activity activity);

The showInAppNotificationUI method can also be called with an OnButtonClickListener and takes a Class as an argument

Pyze.showInAppNotificationUI(this, new InAppNotificationTemplateDialogFragment.OnButtonClickListener() {
  @Override
  public void onButtonClicked(Pyze.InAppStatus inAppStatus) {
    //CTA Button Clicked
  }
});

//Code to dismiss the In-app message
public static void closeInAppMessageDialog(android.app.Activity activity);

Alternatively, use showInAppNotificationUI:... method with parameters 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 or PyzeInAppTypeRead enumerations.

Pyze.showInAppNotificationUI(this, Constants.PyzeInAppMessageType.PyzeInAppTypeAll, "#C9C9C9", new InAppNotificationTemplateDialogFragment.OnButtonClickListener() {

                  //NOTE: In-App Notification Color Codes must be specified as 6 digit Hex Codes
  @Override
  public void onButtonClicked(Pyze.InAppStatus inAppStatus) {
    //CTA Button Clicked
  }
});

//Code to dismiss the In-app message
public static void closeInAppMessageDialog(android.app.Activity activity);
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.

     //Method
     public static void countNewUnFetched(final PyzeInAppMessagesManager.GetUnreadMessageCountListener listener)
    
     //Usage
     Pyze.countNewUnFetched(listner);
    
  • 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.

     //Method
     //Note: PyzeInAppMessageType specified as PyzeInAppTypeUnread, PyzeInAppTypeRead or PyzeInAppTypeAll
     public static void getMessageHeadersForType(final Constants.PyzeInAppMessageType messageType,
                  final PyzeInAppMessagesManager.GetUnreadMessageMetadataListener listener)
    
     //Usage
     getMessageHeadersForType(messageType, listener);
    
  • Get Message Body

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

     //Method
     public static void getMessageWithContentID(final String mId, final String cId, final PyzeInAppMessagesManager.GetMessageListener listener)
    
     //Usage
     getMessageWithContentID(mId, cId, listener);
    
  • Sample Custom In-App Notification UI Activity

    The below sample code shows how to use the Pyze API methods to implement a custom In-App Notification UI

     //Class shows sample implementation of in-app notification API methods
     /**
      * Sample Class to implement custom In-App Notification UI.  
      * For default Pyze In-App Notification UI, just call Pyze.showInAppNotificationUI(this.getApplication());
      */
    
     import android.app.Activity;
     import android.os.Bundle;
     import android.widget.TextView;
     import android.widget.Toast;
    
     import com.pyze.android.Pyze;
     import com.pyze.android.constants.Constants;
     import com.pyze.android.inapp.PyzeInAppMessagesManager;
     import com.pyze.android.inapp.dto.Message;
     import com.pyze.android.inapp.dto.Metadata;
     import com.pyze.android.inapp.dto.MetadataList;
    
    
     public class CustomInAppMessageActivity extends Activity {
    
         @Override
         protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_custom_inapp_msg);
             downloadInAppMessge();
         }
    
         private void downloadInAppMessge() {
             /*
             PyzeInAppTypeAll - New messages from server, unread and read messages from cache.
             PyzeInAppTypeUnread - Unread and read messages from cache.
             PyzeInAppTypeRead - Read messages from cache.
              */
             Pyze.countNewUnFetched(new PyzeInAppMessagesManager.GetUnreadMessageCountListener() {
                 @Override
                 public void onUnreadMessageCountDownloaded(int count) {
                     if (count > 0) {
                         Pyze.getMessageHeadersForType(Constants.PyzeInAppMessageType.PyzeInAppTypeUnread, new PyzeInAppMessagesManager.GetUnreadMessageMetadataListener() {
                             @Override
                             public void onUnreadMessageMetadataDownloaded(MetadataList metadataList) {
                                 if (metadataList != null && !metadataList.isEmpty()) {
                                     Metadata metadata = metadataList.get(0);
                                     Pyze.getMessageWithContentID(metadata.mid, metadata.cid, new PyzeInAppMessagesManager.GetMessageListener() {
                                         @Override
                                         public void onMessageDownloaded(Message message) {
                                             ((TextView) findViewById(R.id.textview_message)).setText(message.body);
                                         }
                                     });
                                 }
                             }
                         });
                     } else {
                         Toast.makeText(CustomInAppMessageActivity.this, "No in-app messages found", Toast.LENGTH_LONG).show();
                     }
                 }
             });
    
         }
     }
    

Sending In-App notifications from growth.pyze.com

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

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

getTags

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

Usage

PyzePersonalizationIntelligence.getTags(new TagsManager.OnRequestTagsListener() {
            @Override
            public void onTagsRequested(HashSet<String> hashSet) {
                Log.d(Tag, "isTagSet: i/p: loyal " + PyzePersonalizationIntelligence.isTagSet("loyal"));
                Log.d(Tag, "areAnyTagsSet: i/p: loyal, whale " + PyzePersonalizationIntelligence.areAnyTagsSet(new String[]{"loyal", "whale"}));
                Log.d(Tag, "areAllTagsSet: i/p: loyal, whale " + PyzePersonalizationIntelligence.areAnyTagsSet(new String[]{"loyal", "whale"}));
                }
            });

isTagSet

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

Usage

Log.d(Tag, "isTagSet: i/p: loyal " + PyzePersonalizationIntelligence.isTagSet("loyal"));

areAnyTagsSet

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

Log.d(Tag, "areAnyTagsSet: i/p: loyal, whale " + PyzePersonalizationIntelligence.areAnyTagsSet(new String[]{"loyal", "whale"}));

areAllTagsSet

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

Log.d(Tag, "areAllTagsSet: i/p: loyal, whale " + PyzePersonalizationIntelligence.areAnyTagsSet(new String[]{"loyal", "whale"}));