Singular iOS SDK | |
---|---|
Download |
Singular iOS SDK version 10.3.0 |
Compatibility | iOS 8+ |
Sample App |
Our sample app includes a complete integration of the Singular SDK. Review the code to see how the different parts of the integration come together using 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 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.
event Method | |
---|---|
Description | Send a user event to Singular for tracking. |
Signature | +(void)event:(NSString *)name |
Usage Example |
Objective-C:
Swift (requires bridging header):
|
eventWithArgs Method | |
Description | Send a user event to Singular for tracking, with additional information. |
Signature | +(void)eventWithArgs:(NSString *)name, ... |
Usage Example |
Objective-C:
Swift (requires bridging header):
|
event Method (with Arguments in NSDictionary format) | |
Description | Send a user event to Singular for tracking, with additional information passed in an NSDictionary object. |
Signature | + (void) event:(NSString *)name withArgs:(NSDictionary *)args; |
Usage Example |
Objective-C:
Swift:
|
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.
To report revenue events to Singular, use the iapComplete SDK method. This method sends an IAP (Apple's In-App Purchase) revenue event to Singular, and passes:
- All the transaction details, which Singular will use to enrich your reports with data.
- The transaction receipt, which can be used to validate the transaction and to analyze and prevent fraud attempts.
Note: Any revenue reported in a different currency will be auto-converted to your organization's preferred currency, as set in your Singular account.
iapComplete Method | |
---|---|
Description | Send a revenue event to Singular with the transaction receipt. |
Signature | (void)iapComplete:(id)transaction (void)iapComplete:(id)transaction withName:(NSString *)name; |
Usage Example |
Objective-C:
Swift:
|
Alternative Revenue Event Reporting
While Singular recommends using iapComplete, we also provide two other methods to report revenue events to Singular - revenue and customRevenue.
These methods let you specify the transaction amount and currency manually, as well as optional additional details, such as the product serial number and quantity. customRevenue also lets you pass a custom event name.
Note that if you use these methods, Singular does not get the transaction receipt and cannot validate the transaction.
revenue Method | |
---|---|
Description | Send a revenue event to Singular with the revenue amount and currency, and optional additional details. |
Signature | (void)revenue:(NSString *)currency amount:(double)amount; (void)revenue:(NSString *)currency amount:(double)amount productSKU:(NSString *)productSKU productName:(NSString *)productName productCategory:(NSString *)productCategory productQuantity:(int)productQuantity productPrice:(double)productPrice; Note: Pass currency as a three-letter ISO 4217 currency code, e.g, “USD,” “EUR”, “INR”. |
Usage Example |
Objective-C:
Swift:
|
customRevenue Method | |
Description | Send a revenue event to Singular with an event name as well as the revenue amount and currency, and optional additional details. |
Signature | (void)customRevenue:(NSString *)eventName currency:(NSString *)currency amount:(double)amount; (void)customRevenue:(NSString *)eventName currency:(NSString *)currency amount:(double)amount productSKU:(NSString *)productSKU productName:(NSString *)productName productCategory:(NSString *)productCategory productQuantity:(int)productQuantity productPrice:(double)productPrice; Note: Pass currency as a three-letter ISO 4217 currency code, e.g, “USD,” “EUR”, “INR”. |
Usage Example |
Objective-C:
Swift:
|