Appcelerator - Android

Appcelerator Android SDK

Before starting your application instrumentation, ensure that you have created an app and have an appKey

Install

  1. Copy the plugin zip inside your project directory

  2. Open tiapp.xml and under modules add the following line

<module version="1.0.0" platform="android">ti.pyze</module> 

Initialize

Open tiapp.xml and add the pyze app key as follows

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
     <application>
       <meta-data android:name="PyzeAppKey" android:value="YOUR PYZE APP KEY"/>
     </application>
    </manifest>
 </android>

Import pyze module and get a reference for the module

var pyze = require('ti.pyze');

Custom Events

Custom events allow you to easily track unique user actions within your app.

Event

pyze.postCustomEvent("Event Name");

This allows you to track when a user executed an action, for a simple count of how often that event is occurring.

Event with Attributes

Attributes are any key-value pair that you can attach to an event. You can have up to 99 attributes with any event. It is highly recommended to follow our Best Practices and heavily rely on attributes to make your instrumentation as minimal and useful as possible. In a typical application, you should have many more attributes than events.

import {PyzeEvents} from 'ti.pyze'; //Import PyzeEvents class from the Pyze Appcelerator package

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

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

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) 

In-App Notifications

In-app notifications allow app businesses to reach out to app users when they use your app. In-App notifications are built-in to the pyze sdk and have no additional dependecies.businesses to reach out to users from manually from Dynamic Funnels and Intelligence Explorer, and automatically based on workflows and campaigns from Growth Automation. In-App notifications can be sent from Campaigns

Call the following method, wherever you want to check for new messages and pop-up a modal with the notification:

Method accepts a callback handler method which will be invoked whenever any of the call to action button on the UI is pressed.

showInAppNotification(callback);

Usage

pyze.showInAppNotification(function(params){
            Ti.API.info("Params" + params);
})

API Reference

Full API reference available here

Last modified 2020-12-03