Singular React Native SDK | |
---|---|
Download |
Singular React Native SDK version 1.1.6 |
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.
You can send events to Singular using the event and eventWithArgs methods.
Note:
- We highly recommend passing event names and attributes in English to guarantee compatibility with third-party partners and analytics solutions if you plan to use them.
- Event names are limited to 32 characters in ASCII. If you use non-ASCII characters, the limit is 32 bytes after the string is converted to UTF-8.
- The names and values of additional attributes are limited to 500 ASCII characters.
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 |
|
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.
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 |
|