Singular Unreal Engine SDK |
|
---|---|
Download |
Singular Unreal Engine SDK version 2.4.0 |
Compatibility |
Unreal Engine 4.23+ |
Integration Guides |
Creating Short Referrer Links
Note: This functionality is available in SDK version 2.0.6+.
Use short links to transform long, parameter-filled Singular Links into shorter and more secure links that are convenient for sharing.
Typically, you will want to create short links dynamically so that your app's users can share them with friends to invite them to use the app.
To create a short link, you need:
- A Singular Link that leads to your app download (see the Singular Links FAQ).
- Any parameters you want to add to the link dynamically (see Tracking Link Parameters for the list of options).
- The name and ID of the referring user, if you want to be able to track new app installs back to the user who shared the link.
To enable short links, first add this code to the main character constructor:
if (AUnrealTestAppCharacter::singularDelegates == NULL) {
AUnrealTestAppCharacter::singularDelegates =
CreateDefaultSubobject<USingularDelegates>(TEXT("SingularShortLinksHandler"));
singularDelegates->OnSingularShortLinksResolved.AddDynamic(this, &AUnrealTestAppCharacter::SingularShortLinksResolved);
}
void AUnrealTestAppCharacter::SingularShortLinksResolved(const FSingularShortLinkParams& linkParams) {
const FString shortLinkURL = linkParams.SingularShortLinksParams["data"];
const FString errorMessage = linkParams.SingularShortLinksParams["error"];
// Add your share logic here
// If there is an error, add logic to retry/abort/modify the params passed
// to the function, based on the cause of the error
}
Then use the CreateReferrerShortLink method to create a short link as in the example below.
// Add parameters to the link (if they don't already exist in the long link URL)
TMap<FString, FString> params;
params.Add(TEXT("channel"), TEXT("sms"));
params.Add(TEXT("anotherparam"), TEXT("paramvalue"));
// Create the short link based on the original Singular Link URL
// with a referrer name, referrer ID, and optional additional parameters
USingularSDKBPLibrary::CreateReferrerShortLink(
"https://sample.sng.link/B4tbm/v8fp?_dl=https%3A%2F%2Fabc.com",
"referrer name",
"referrer ID",
params
);
Tracking Uninstalls
Note: Uninstall tracking is only available to Enterprise customers.
Android Uninstall Tracking
To enable uninstall tracking for your Android app, first configure the app in the Singular platform as detailed in Setting Up Uninstall Tracking. Then follow the instructions below.
Note: Google deprecated the GCM APIs on April 2018. Use FCM for uninstall tracking.
Enabling Uninstall Tracking Using Firebase Cloud Messaging (FCM)
1. Integrate with FCM:
To track uninstalls, you can use the services of the Firebase Cloud Messaging (FCM) platform. If you are not already using FCM follow Google's instructions on how to Set up a Firebase Cloud Messaging client app on Android.
FCM Requirements (source)
FCM clients require devices running Android 4.1 or higher that also have the Google Play Store app installed, or an emulator running Android 4.1 with Google APIs. Note that you are not limited to deploying your Android apps through Google Play Store.
Users/devices who are not running on supported versions of Android will not be available for Singular uninstall tracking.
2. Update the AndroidManifest.xml File:
Update your AndroidManifest.xml file to add the necessary intent filter for your app (replace MyFirebaseMessagingService with your class that implements the Firebase Service):
<service android:name=".java.MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter> </service>
<service
android:name=".java.MyFirebaseMessagingService"
android:exported="false">
intent-filter>
action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
3. Register and Send the FCM Device Token:
Finally, set the FCM device token after your SingularConfig is initialized in OnCreate(), as follows:
Singular.setFCMDeviceToken(String fcmDeviceToken);
iOS Uninstall Tracking
Uninstall tracking on iOS is based on Apple push-notification technology. If your app doesn't currently support push notifications, see Apple's guide. If your app already supports push notifications, all you need to do is pass the device token returned from APNS using the RegisterDeviceTokenForUninstall method, after the SDK is initialized.
SingularSDK SetUninstallToken Method |
|
---|---|
Description | Pass the device token returned from APNS / FCM. Note that the APNS / FCM token is usually binary data in the native form, but you need to pass it as a string. |
Signature |
|
Usage Example |
|
Complying with Data Privacy Laws
Singular provides privacy-safeguarding functionality to help you cooperate with any partners who may be complying with consumer privacy laws such as GDPR and CCPA (California Consumer Privacy Act). These partners want to be notified if the end-user has consented to share their private information.
LimitDataSharing
If you have implemented a way to ask users for consent to share their information, use the limitDataSharing method to notify Singular of the user's choice:
- Use limitDataSharing:NO to indicate that the user consented (opted in) to share their information.
- Use limitDataSharing:YES if the user did not consent.
Singular uses LimitDataSharing in "User Privacy Postbacks" as well as passing this information on to partners who require it in order to comply with relevant regulations. See "User Privacy and Limit Data Sharing" for more information.
Note: The use of the method is optional, but there may be attribution information that the partner will share with Singular only if specifically notified that the user has opted in.
SingularSDK LimitDataSharing Method | |
---|---|
Signature | public void LimitDataSharing(bool shouldLimitDataSharing) |
Description | Notify Singular of user consent (opt-in) for sharing private data. The Limit Data Sharing method gives you an option to control whether your app sends user data to third parties. This is useful if you want to restrict data sharing based on user preferences or privacy requirements. |
Usage Example |
|
Additional Methods for GDPR Compliance
The Singular SDK provides several methods to help you comply with GDPR policies and let Singular know about user consent or non-consent for tracking.
SingularSDK TrackingOptIn Method | |
---|---|
Description | Notify Singular of user consent (opt-in) for tracking. The TrackingOptIn() method is used to send a "gdpr" event to Singular's servers. If you don't call this method, the app will continue tracking users as if they have given consent, but it won't specifically mark them as GDPR opt-in. If your app needs to comply with GDPR (General Data Protection Regulation), you should call this function to ensure that user consent is properly recorded. |
Usage Example |
|
SingularSDK StopAllTracking Method | |
Description | Stop all tracking activities for this user on this app.
Note: Calling this method effectively disables the SDK, even after the app restarts (the state is persistent)! The only way to re-enable tracking is by calling resumeAllTracking().
|
Usage Example |
|
SingularSDK ResumeAllTracking Method | |
Description | Resume tracking for this user on this app. |
Usage Example |
|
SingularSDK IsAllTrackingStopped Method | |
Description | Check the tracking status for this user on this app. Returns true if tracking has been stopped using StopAllTracking() and not resumed. |
Usage Example |
|
Singular Unreal Engine SDK |
|
---|---|
Integration Guides |