The Singular SDK is available as a plug-in for Segment. The instructions below show you how to add Singular in your Segment setup and enable the Singular SDK in your app.
Optional features include forwarding in-app events, adding the end-user's ID, and support for SKAdNetwork (on iOS devices).
Guide for | Engineering Teams |
Prerequisites | This article assumes you already have the Segment SDK integrated in your app. |
Steps for iOS Integration
1 |
Add Singular as a DestinationTo begin, set up a Singular destination in your Segment dashboard. You will need the Singular SDK Key and SDK Secret (you can retrieve them by logging into your Singular account and going to Developer Tools > SDK Keys). |
2 |
Add the SDK to your Project
|
3 |
Add Code to Initialize the Singular SDK
|
4 |
[OPTIONAL] Implement Event TrackingUse the Segment track function to have events translated and sent to Singular:
Segment includes all the event properties as callback parameters on the Singular event, and automatically translates properties.revenue to the appropriate Singular purchase event properties. Purchase event example:
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR". |
5 |
[OPTIONAL] Implement User IdentificationThe Singular SDK can send a user ID from your app to Singular. This can be a username, email address, randomly generated string, or whichever identifier you use as a user ID. Singular uses the user ID in user-level data exports as well as internal BI postbacks (if you configure such postbacks). To set user identification, call the identify method:
To unset the user ID, call the reset method:
|
6 |
[OPTIONAL] Implement SKAN supportThe Singular SDK can control your SKAdnetwork integration. For details on how this works, see iOS SDK: Adding SKAdNetwork Support. To let Singular control your SKAdNetwork integration, add the following code before the initialization of the Segment SDK:
|
Steps for Android Integration
1 |
Add Singular as a DestinationTo begin, set up a Singular destination in your Segment dashboard. You will need the Singular SDK Key and SDK Secret (to retrieve them, log into your Singular account and go to Developer Tools > SDK Keys). |
2 |
Add the Plugin to Your ProjectAdd the Singular Segment integration dependency to your app's build.gradle file:
|
3 |
Add the Required PermissionsThe AndroidManifest.xml file should include the following permissions:
|
4 |
Add Code to Initialize the Singular SDKUse the following code to initialize the Singular SDK in your app. Add .trackApplicationLifecycleEvents() to send app open, app updated, and app installed events to Singular.
|
5 |
[OPTIONAL] Implement Event TrackingUse the Segment track function to have events translated and sent to Singular:
Segment includes all the event properties as callback parameters on the Singular event, and automatically translates properties.revenue to the appropriate Singular purchase event properties. Purchase event example:
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR". |
6 |
[OPTIONAL] Implement User IdentificationThe Singular SDK can send a user ID from your app to Singular. This can be a username, email address, randomly generated string, or whichever identifier you use as a user ID. Singular uses the user ID in user-level data exports as well as internal BI postbacks (if you configure such postbacks). To set the user ID, call the identify method:
To unset the user ID, call the reset method:
|