Appian Getting Started

Learn more about installing the Pyze Analytics Component, initializing it, using timed and custom events.

1. Get a Pyze App Key

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

2. Initialize

Add initialization code to all your appian interfaces

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 and timed events.

4. Add events

Add events to your Appian app.

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

  • 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

Navigate to the newly added app’s settings by ensuring the app you just added is selected from the dropdown menu and copy the Pyze App Key (DmPTFdslRjObk1-ZlXQDVQ in this example).

Install

Install and initialize Pyze Analytics Component

Install Pyze Analytics Component

The instructions on this page assume you have obtained the Pyze App Key for your project. If not, visit Getting Started Web Guide to get the Pyze App key.

Get the Pyze Ananytics Component from Appian AppMarket

Initialize Pyze Analytics Component

  • Create a common Expression Rule for Pyze Analytics Component (ex: PDPyze) for the application.
  • Paste the following code inside Expression Rule Component
/*Get pyze app key from https://grwoth.pyze.com */
{
   pyze(
      pyzeAppKey: "YOUR_PYZE_APP_KEY",
      methodName: ri!methodName,
      eventName: ri!eventName,
      attributes:ri!attributes,
      userId: ri!userId,
      pyzeProfileAttributes: ri!pyzeProfileAttributes,
      customProfileAttributes: ri!customProfileAttributes,
      /*randomString: (rand()-0.5)/500*/
   )
}

Remember to replace “YOUR_PYZE_APP_KEY” with the Pyze App key you got from growth.pyze.com

  • Also, create the input variables methodName, eventName, attributes, userId, pyzeProfileAttributes, and customProfileAttributes as shown below.
  • Add the local variable to your interface and make sure method name is set to initialize. This will ensure that when page is loaded initialize method is invoked.
local!methodName : "initialize",
local!eventName : "",
local!attributes : {},
local!userId:"",
local!pyzeProfileAttributes:{},
local!customProfileAttributes:{},
  • Add the expression rule to each of interface of your application.
rule!PDPyze(
   methodName: local!methodName,
   eventName:  local!eventName,
   attributes: local!attributes,
   userId: local!userId,
   pyzeProfileAttributes: local!pyzeProfileAttributes,
   customProfileAttributes: local!customProfileAttributes
)

Optionally, you can ommit varible if you aren’t using them. Ex: if we aren’t calling profile API, above snippet would look like this.

/*
* Local variables
*/
local!methodName : "initialize",
local!eventName : "",
local!attributes : {},

...

/*
* Component with fewer variables.
*/
rule!PDPyze(
   methodName: local!methodName,
   eventName:  local!eventName,
   attributes: local!attributes
)

Build and Go!

Add Events

Pyze has made it easy for you to capture events. We support custom and timed events.

Custom Event Handling

We support custom events that can be used to track any event within the application and can be called with or without attributes. Invoke Pyze API by updating local variables inside saveIntos. See postCustomEvent and postCustomEventWithAttributes method for more info.

// Custom Event without Attributes
saveInto: {
   a!save(local!methodName,"postCustomEvent"),
   a!save(local!eventName, "YOUR_EVENT_NAME")
}

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

saveInto: {
   a!save(local!methodName,"postCustomEventWithAttributes"),
   a!save(local!eventName, "YOUR_EVENT_NAME"),
   a!save(local!attributes, {attr1:value1, attr2:123})
}

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. You can also pass attributes as additional parameter as shown in the example below


//Start timer for event
saveInto: {
   a!save(local!methodName,"startTimerForEvent"),
   a!save(local!eventName, "YOUR_EVENT_NAME")
}

//Post timed event. 
//Note : The event name attribute for the `startTimerForEvent` and  `postTimedEvent` should match.
saveInto: {
   a!save(local!methodName,"postTimedEvent"),
   a!save(local!eventName, "YOUR_EVENT_NAME")
}

//Post timed event API when you want to send additional attributes
saveInto: {
   a!save(local!methodName,"postTimedEventWithAttributes"),
   a!save(local!eventName, "YOUR_EVENT_NAME"),
   a!save(local!attributes, {attr1:value1, attr2:123})
}

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.

setUserProfile

To set user Profile, use the following API as shown below.

//Create Pyze Profile Attributes object
saveInto: {
   a!save(local!methodName,"setUserProfile"),
   a!save(local!userId, "USER_UNIQUE_IDENTIFIER"),
   a!save(local!pyzeProfileAttributes, {first_name:John),
   a!save(local!customProfileAttributes, {city:XYZ)
}

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

updateUserProfile

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

Note : Do not call this api before calling setUserProfile.

saveInto: {
   a!save(local!methodName,"updateUserProfile"),
   a!save(local!pyzeProfileAttributes, {first_name:John),
   a!save(local!customProfileAttributes, {city:XYZ)
}

resetUserProfile

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

saveInto: {
   a!save(local!methodName,"resetUserProfile")
}

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.

saveInto: {
   a!save(local!methodName,"setUserOptOutToTrue")
}

To resume user data collection set value to false

saveInto: {
   a!save(local!methodName,"setUserOptOutToFalse")
}

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.

saveInto: {
   a!save(local!methodName,"deleteUser")
}