Braze

Purchasely can send all your transactional events to Braze to enrich your users data. Use these events to trigger automatic campaigns, pushs...

Events

The following events will be sent. You can set the event name of your choice in the console.

Event

Description

PURCHASE_VALIDATED

Sent when the user purchased a product wether it is the start of a trial or a regular purchase of a consumable product.

RENEWAL_DISABLED

Sent when the user deactivates the renewal of a subscription wether it is in trial period or not.

RENEWAL_ENABLED

Sent when the user reactivates

SUBSCRIPTION_EXPIRED

Sent when the subscription actually ends

SUBSCRIPTION_RENEWED

Sent when a subscription renews

TRIAL_STARTED

Sent when a trial starts

TRIAL_CONVERTED

Sent when a user converts from a free trial to a normal paid-period

TRIAL_NOT_CONVERTED

Sent when a user finishes it's trial period without renewing to a paid-period

Associate users to events

There is nothing special to be done to associate Purchasely events to your logged in users in Braze. Just setup Braze SDK as you would normally, and use the changeUser method to set the user ID in Braze:

Swift
Objective-C
Kotlin
Java
React Native
Cordova
Swift
Appboy.sharedInstance()?.changeUser("YOUR_USER_ID")
Objective-C
[[Appboy sharedInstance] changeUser:@"YOUR_USER_ID"];
Kotlin
Appboy.getInstance(context).changeUser("YOUR_USER_ID")
Java
Appboy.getInstance(context).changeUser("YOUR_USER_ID");
React Native
ReactAppboy.changeUser("YOUR_USER_ID");
Cordova
AppboyPlugin.changeUser("YOUR_USER_ID");

Make sure the User ID you give to Braze matches thevendor_id you give to Purchasely, as our servers refer to this ID when sending events for the user. Read Braze documentation on Setting User IDs for more information.

Handle anonymous users

If you have anonymous users in your app, you will need to add their Purchasely anonymous_id as a user alias to Braze:

Swift
Objective-C
Kotlin
Java
React Native
Cordova
Swift
Appboy.sharedInstance()?.user.addAlias(
Purchasely.anonymousUserId,
withLabel: "purchasely_anonymous_id"
)
Objective-C
[[Appboy sharedInstance].user addAlias:[Purchasely anonymousUserId] withLabel:@"purchasely_anonymous_id"];
Kotlin
Appboy.getInstance(applicationContext)?.currentUser?.addAlias(
Purchasely.anonymousUserId,
"purchasely_anonymous_id"
)
Java
Appboy.getInstance(getApplicationContext()).getCurrentUser().addAlias(
Purchasely.getAnonymousUserId(),
"purchasely_anonymous_id"
);
React Native
ReactAppboy.addAlias(
Purchasely.getAnonymousUserId(),
"purchasely_anonymous_id"
);
Cordova
AppboyPlugin.addAlias(
Purchasely.anonymousUserId,
withLabel: "purchasely_anonymous_id"
);

The label MUST be set to "purchasely_anonymous_id", as our servers refer to this label when sending events while the user is anonymous.

When the anonymous user later becomes logged in, Purchasely will automatically send following events using the provided vendor_id

Configure the integration in the Purchasely Console

Go to the "External integrations" section, and open the edition form for Braze:

Getting Braze API key

Go to your Braze Developer Console, and click on "Create New API Key"

Give a relevant name to your API Key. In the "User Data" permission area, check users.track as our servers need this permission to report backend events to Braze.

Click "Save API Key" at the bottom of the page.

Finally, paste the API key Identifier value into Purchasely console.

Selecting the correct REST Server

Refer to Braze API Endpoints table. You can use your Braze Dashboard URL find the correct server. E.g. if your dashboard is accessible at https://dashboard-01.braze.eu, then you should select the EU-01 server.

Customising Server Event Names

If you want to, you can rename events sent to Braze:

Please refer to Braze documentation on Event Naming Conventions to choose appropriate event names.

Event properties

Each event sent to Braze carries a set of properties that you can use to further personalize your campaigns:

Property

Description

application_name

Name of the application as set in Purchasely Console, e.g. "Purchasely Demo"

application_package_id

Application package ID in the Store, e.g. "com.purchasely.demo"

application_platform

Platform of the application, e.g. "ANDROID"

plan_id

Plan Vendor ID, e.g. "PURCHASELY_PLUS_MONTHLY"

plan_name

Plan name as set in Purchasely Console, e.g. "Monthly"

plan_store_product_id

Store product identifier, e.g. "com.purchasely.plus.monthly"

plan_type

Type of the plan, e.g. "RENEWING_SUBSCRIPTION"

product_id

Product Vendor ID, e.g. "PURCHASELY_PLUS"

product_name

Product name as set in Purchasely Console, e.g. "Purchasely +"

store

Store associated with the event, e.g. "GOOGLE_PLAY_STORE"

Read Braze documentation on Custom Event Properties for more details on how you can use the properties above.