Learn how to log in-app purchases through the Braze SDK, so you can determine your revenue over-time and across sources. This will let you segment users based on their lifetime value using custom events, custom attributes, and purchase events.
note:
For wrapper SDKs not listed, use the relevant native Android or Swift method instead.
Logging purchases and revenue
To log purchases and revenue, call logPurchase() after a successful purchase in your app. If the product Identifier is empty, the purchase will not be logged to Braze.
If you’d like to use Google Tag Manager instead, you can use the Purchase tag type to call the logPurchase method . Use this tag to track purchases to Braze, optionally including purchase properties. To do so:
The Product ID and Price fields are required.
Use the Add Row button to add purchase properties.
If your site logs purchases using the standard ecommerce event data layer item to Google Tag Manager, then you can use the E-commerce Purchase tag type. This action type will log a separate “purchase” in Braze for each item sent in the list of items.
You can also specify additional property names you want to include as purchase properties by specifying their keys in the Purchase properties list. Note that Braze will look within the individual item that is being logged for any purchase properties you add to the list.
For example, given the following ecommerce payload:
If you only want item_brand and item_name to be passed as purchase properties, then just add those two fields to the purchase properties table. If you don’t supply any properties, then no purchase properties will be sent in the logPurchase call to Braze.
By default, quantity is set to 1. However, you can add a quantity to your purchases if customers make the same purchase multiple times in a single checkout. To add a quantity, pass an Int value to quantity that’s within the range of [0, 100].
Using the REST API
You can also use our REST API to record purchases. For more information, refer to User Data Endpoints.
Logging orders
If you want to log purchases at the order level instead of the product level, you can use order name or order category as the product_id. Refer to our purchase object specification to learn more.
Reserved keys
The following keys are reserved and cannot be used as purchase properties:
time
product_id
quantity
event_name
price
currency
Supported currencies
These are the supported currency symbols. Any other currency symbol you provide will log a warning and the purchase will not be logged to Braze.