Singular Android SDK | |
---|---|
Download |
Singular Android SDK version 9.6.0 |
Compatibility |
Android 4.0.1 (Ice Cream Sandwich) and higher
|
Sample App | Review our sample app for an example of a complete SDK integration based on best practices. |
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 eventJSON 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 ASCII characters. Strings in non-ASCII characters have to be under 32 bytes once converted to UTF-8.
- Attributes and values are limited to 500 ASCII characters.
Singular.event Method | |
---|---|
Description | Report a user event to Singular with or without additional information. |
Signature |
Singular.event(String eventName) Note: 'args' is one or more key-value pairs (see the example below). The key is a string and the value can be any type that's allowed as a JSONObject value (i.e., JSONObject, JSONArray, String, Boolean, Integer, Long, Double or NULL). The 'args' list must contain an even number of elements or the event will be rejected by Singular. |
Usage Example |
|
Singular.eventJSON Method | |
Description | Report a user event to Singular with additional information in JSONObject format. |
Signature |
Singular.eventJSON(String name, JSONObject args)
Note: 'args' is a JSONObject containing one or more key-value pairs. The key is a string and the value can be any type that's allowed as a JSONObject value.
|
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 received from the billing library. This has two advantages:
- Singular gets all the details of the transaction, which enriches your Singular reports.
- Singular gets the transaction receipt from Google which can be used to validate the transaction in the context of fighting in-app fraud.
Use the revenue and customRevenue methods to report events. CustomRevenue allows you to pass a custom event name, so that you'll be able to view revenue in Singular reports broken down by the different types of revenue events.
Note: Any revenue reported in a different currency will be auto-converted to your organization's preferred currency, as set in your Singular account.
Singular.revenue Method | |
---|---|
Description | Send a revenue event to Singular with optional additional information. |
Signature |
Singular.revenue(String currency, double amount, Object purchase) Note:
|
Usage Example |
|
Singular.customRevenue Method | |
Description | Send a revenue event to Singular with an event name and optional additional information. |
Signature |
Singular.customRevenue(String eventName, String currency, double amount, Object purchase) Note:
|
Usage Example |
|
Reporting Revenue without the Purchase Object
While we strongly recommend reporting revenue events the way described above, you can also use revenue and customRevenue without passing the purchase object. Instead, you pass the currency and amount of the transaction, and optional product details.
Note that when reporting revenue events this way, Singular does not get the purchase receipt and cannot validate the transaction.
Singular.revenue Method (Without Purchase Object) | |
---|---|
Description |
Send a revenue event to Singular with optional additional information. |
Signature |
Singular.revenue(String currency, double amount, String productSKU, String productName, String productCategory, int productQuantity, double productPrice) Singular.revenue(String currency, double amount) Note: Pass currency as a three-letter ISO 4217 currency code, such as “USD”, “EUR”, or “INR". |
Usage Example |
|
Singular.customRevenue Method (Without Purchase Object) | |
Description | Send a revenue event to Singular with an event name and optional additional information. |
Signature |
Singular.customRevenue(String eventName, String currency, double amount, String productSKU, String productName, String productCategory, int productQuantity, double productPrice) Note: Pass currency as a three-letter ISO 4217 currency code, such as “USD”, “EUR”, or “INR". |
|
Integration Guides |