Singular React Native SDK | |
---|---|
Download |
Singular React Native SDK version 3.3.0 (see Change Log) |
Compatibility | React Native 0.46.4+ |
Integration Guides |
Tracking Events
Singular can collect data about in-app events to help analyze the performance of your campaigns and measure KPIs. For example, your organization may want to collect data about user logins, registrations, tutorial completions, or leveling up in a gaming app.
Singular supports a variety of standard events. These commonly used events are often supported by ad networks for reporting and optimization. Another advantage is that when you use standard event names, Singular recognizes them automatically and adds them to the Events list without you having to define them manually. We recommend using standard events whenever possible.
The list of events sent to Singular (with the accompanying attributes) should be compiled by the UA/marketing/business team based on your organization's marketing KPIs. The business team can follow the guide at How to Track In-App Events: Guide For Singular Attribution Customers.
With each event you track, you can pass various attributes. See the recommended standard attributes per event.
In your code, send events to Singular using the event or eventWithArgs methods.
Note: For standard events, use the event's React Native name as it appears in the React Native SDK: List of Standard Events and Attributes, e.g., sngLogin.
For custom events, events that your organization wants to measure that do not match any of Singular's standard events, use any custom name (maximum of 32 characters). We recommend using names in English for compatibility with any ad network partners that may receive the event from Singular for optimization purposes.
Singular.event Method | |
---|---|
Description | Report a user event to Singular, passing the name of the event. |
Usage Example |
|
Singular.eventWithArgs Method | |
Description | Report a user event to Singular, passing the name of the event and any additional information you want to add, in the form of a map/object. |
Usage Example |
|
Tracking Revenue
Singular can collect data about revenue gained through the app to help analyze the performance and ROI of your campaigns. Singular will make the data available to you in reports, log export, and postbacks.
When reporting revenue events to Singular, we recommend passing the purchase object as returned from Android's or iOS's In-App Purchase (IAP) process. This way, Singular gets all the details of the transaction, which enriches your Singular reports with data. In addition, Singular gets the transaction receipt from Google which can be used to validate the transaction in the context of fighting in-app fraud.
Passing the Purchase Object in React Native
This method requires using React Native's In-App Purchase package to manage transactions in your app.
Singular.inAppPurchase Method | |
---|---|
Description | Report an IAP event to Singular. |
Usage Example |
|
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR".
Passing the Purchase Object Using Native Code
If you don't use a React Native In-App Purchase package, you can still send revenue events to Singular with the purchase object, but you have to use native iOS and Android code.
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR".
iOS
iapComplete:transaction Method | |
---|---|
Description | Report an IAP event to Singular with all the details, optionally adding a name for the event. |
Usage Example |
|
Android
To take advantage of Android's IAP functionality, first add the following to your app's build.gradle file:
implementation 'com.singular.sdk:singular_sdk:9.+
Singular.revenue Method | |
---|---|
Description | Report a revenue event to Singular with the purchase object that is received from the Google Billing Library. |
Usage Example |
|
Singular.customRevenue Method | |
Description | Report a revenue event to Singular with a custom name for the event and with the purchase object that is received from the Google Billing Library. |
Usage Example |
|
Reporting Revenue Events without the Purchase Object
While we strongly recommend reporting revenue events the way described above, you can also send revenue events to Singular just by passing the currency and transaction amount. Note that this way, Singular does not get the purchase receipt and cannot validate the transaction.
Singular.revenue Method | |
---|---|
Description | Report a revenue event to Singular with the revenue currency and amount. |
Usage Example |
|
Singular.customRevenue Method | |
Description | Report a revenue event to Singular with the revenue currency and amount as well as a custom name for the event. |
Usage Example |
|
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR".