Upsight logo Back to top

Android

Overview

Upsight Android SDK


Upsight is the most comprehensive analytics and marketing platform for web and mobile apps. We are building a business engine to help our customers better understand user behavior, decide what it means, and act to impact key goals.

If you have any questions, contact Upsight Support. We also recommend reviewing our Optimization Guides to learn the best practices and get the most out of your Upsight integration.

Getting Started

Javadocs


Click to view Javadocs.

Getting Started

Basic Integration


The Upsight Android SDK (Software Development Kit) is a set of libraries which enables the use of the Upsight analytics data platform and marketing tools. The SDK architecture combines ease of use while allowing for extensions to be built that can leverage analytics data for advanced usage.

Integrating Upsight's Android's SDK is as simple as 3 easy steps.

The first step is to add the Upsight repository to your application's build.gradle.

allprojects {
    repositories {
        maven {
            url "https://nexus.upsight.com/nexus/content/repositories/upsight-android-release/"
        }
        ...
    }
}

To include all the standard Upsight modules, simply add:

compile 'com.upsight.android:all:4.9.2'

If you would like to use Mediated Ads, also include:

compile 'com.upsight.android:mediation:4.9.2'

You may optionally add each dependency as appropriate to your application instead of including all of them. Please see the Advanced Integration section for more information.

The next step is to add the following in your application Manifest. The application token and public key are provided on the Upsight Dashboard under Settings > Applications > "YOUR_APPLICATION_NAME".

<application>

    <!-- Application token and public key from Upsight Dashboard -->
    <meta-data
        android:name="com.upsight.app_token"
        android:value="UPSIGHT_APPLICATION_TOKEN" />
    <meta-data
        android:name="com.upsight.public_key"
        android:value="UPSIGHT_PUBLIC_KEY" />

    <!-- e.g. android:authorities="com.yourCompany.yourApplication.upsight" -->
    <provider
        android:name="com.upsight.android.internal.persistence.ContentProvider"
        android:authorities="APPLICATION_PACKAGE_NAME.upsight"
        android:enabled="true"
        android:exported="false" />
</application>

In order to access any API from the SDK, the application needs to build an UpsightContext. This should be done in the onCreate() of your Application or Activity, so we begin tracking the session appropriately:

public class SampleActivity extends Activity {

    private UpsightContext mUpsight;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
        // Create an UpsightContext from any Android Context.
        mUpsight = Upsight.createContext(this);
        ...
    }
}

If you wish to enable logging, add the following:

mUpsight.getLogger().setLogLevel(Upsight.LOG_TAG, EnumSet.allOf(UpsightLogger.Level.class));

Tip: You may call Upsight.createContext(android.content.Context) anywhere in your application, and as often as you need a reference to UpsightContext. The same instance will be returned on each call.

Tip: You can use UpsightContext anywhere in your application where you currently use an android.content.Context. It provides extra functionality made available by the Upsight SDK.

Getting Started

Advanced Integration


Modular Dependencies

The Upsight Android SDK is modular, so instead of including com.upsight.android:all, you can selectively add each dependency as appropriate to your application:

compile 'com.upsight.android:analytics:4.9.2'             // To use the Analytics module.
compile 'com.upsight.android:marketing:4.9.2'             // To use the Marketing module.
compile 'com.upsight.android:managed-variables:4.9.2'     // To use the Managed Variables module.
compile 'com.upsight.android:google-advertising-id:4.9.2' // To use the Google Advertising ID module.
compile 'com.upsight.android:google-push-services:4.9.2'  // To use the Google Push Services module.
compile 'com.upsight.android:marketplace:4.9.2'           // To use the Marketplace module.
compile 'com.upsight.android:mediation:4.9.2'             // To use the Mediation module.

Google Play Services

The Google modules automatically pulls in the necessary dependencies from the Google Play Services Client Library 10.2.1. If you wish to manually include a specific version of that library, the Google modules should be added with their appropriate exclude statements instead:

compile ('com.upsight.android:google-advertising-id:4.9.2') {
    exclude group: 'com.google.android.gms', module: 'play-services-ads'
}
compile ('com.upsight.android:google-push-services:4.9.2') {
    exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}

Excluding Metadata

When building your application, the compiler may ask you to exclude certain files in conflict. Here are some common exclusions that you can safely add to your build.gradle.

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/notice.txt'
}

ProGuard

-dontobfuscate

# Upsight
-keep class com.upsight.android.** { *; }
-keep interface com.upsight.android.** { *; }
-dontwarn com.upsight.android.UpsightContext
-dontwarn com.upsight.android.marketing.internal.vast.VastContentModel

# Unity
-keep class com.unity3d.** { *; }
-keep class bitter.jnibridge.** { *; }
-keep class org.fmod.** { *; }

# Upsight mediation
-dontwarn com.upsight.mediation.**
-keep class com.upsight.mediation.** { *; }
-keep interface com.upsight.mediation.** { *; }
-keep class com.google.android.gms.ads.identifier.** { *; }
-keep interface com.google.android.gms.ads.identifier.** { *; }

# Mediation:AdColony
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}
-keepclassmembers class com.adcolony.sdk.ADCNative** {*;}
-keep class com.adcolony.sdk.** { *; }
-dontwarn com.adcolony.sdk.AdColonyPubServicesPushRegIdListenerService
-dontwarn android.app.Activity

# Mediation:AppLovin
-keep class com.applovin.** { *; }
-dontwarn com.applovin.**

# Mediation:Mopub
-keepclassmembers class com.mopub.** { public *; }
-keep public class com.mopub.**
-keep public class android.webkit.JavascriptInterface {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.mobileads.CustomEventRewardedVideo {}
-keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient { *; }
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info { *; }
-dontwarn com.google.android.gms.**
-dontwarn org.apache.http.**
-dontwarn com.mopub.volley.toolbox.**

# Mediation:UnityAds
-keepattributes SourceFile,LineNumberTable
-keepattributes JavascriptInterface
-keep class android.webkit.JavascriptInterface { *; }
-keep class com.unity3d.ads.** { *; }

# Mediation:Vungle
-keep class com.vungle.** { *; }
-keep class javax.inject.*
-dontwarn com.vungle.**

# Mediation:Ironsource
-keep class com.ironsource.adapters.** { *; }
-keep class com.moat.** { public protected private *; }
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
    public *;
}
-dontwarn com.ironsource.**
-dontwarn com.moat.**

# Mediation:AdMob (optional)
-keep public class com.google.android.gms.ads.** { public *; }
-keep public class com.google.ads.** { public *; }

# Mediation:Tapjoy (optional)
-keep class com.tapjoy.** { *; }
-keep class com.moat.** { *; }
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-dontwarn com.tapjoy.**

# Mediation:Chartboost (optional)
-keep class com.chartboost.** { *; }

# HttpHeaders
-dontwarn com.google.common.net.HttpHeaders

# Dagger
-dontwarn dagger.**

# Gson
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }

# Rx
-dontwarn sun.misc.**
-keep class rx.schedulers.Schedulers {
    public static <methods>;
}
-keep class rx.schedulers.ImmediateScheduler {
    public <methods>;
}
-keep class rx.schedulers.TestScheduler {
    public <methods>;
}
-keep class rx.schedulers.Schedulers {
    public static ** test();
}
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    long producerNode;
    long consumerNode;
}

Getting Started

Analytics Module


Custom Events

Events are easier than ever to implement now. To create custom event types simply use the UpsightCustomEvent class as described below:

UpsightCustomEvent
    .createBuilder("your_custom_message_type")  // Required event properties.
    .put(customBundle)                          // Custom property bundle.
    .put(customKey, customValue)                // Custom property override.
    .record(mUpsight);                          // Record event.

For custom events, periods can be used in the event name to create event hierarchy such as category.subcategory.my_event_name.

Tip: The permission requirements android.permission.ACCESS_NETWORK_STATE and android.permission.INTERNET are automatically merged to your application Manifest.

Tip: If you want to record an event without associating it with a particular session, such as certain interactions with an App Widget that you do not wish to count towards an app usage session, you can record the event with recordSessionless() instead.

Getting Started

Marketing Module


Milestones

Milestones are a new way to track user movement through your app and allow you to manage exactly when and where a user sees content. Milestones are triggered when your user reaches a point in your application that you want to track or take action on.

The client tells the server that the user has reached a specific milestone in the application, by recording an UpsightMilestoneEvent as below:

UpsightMilestoneEvent.createBuilder(scope).record(mUpsight);

Milestones have one required property—a "Scope" that uniquely describes that location in your application. Examples of Scope are "main_menu", "inventory", or "level_up".

After Milestones are implemented within the app, they need to be registered in the dashboard. To navigate there go to Settings > Applications > "App Name" > App Settings > Milestones. Then click on "Add Milestone".

Milestones

“Milestone Scope” is what you called the milestone in your app. “Milestone Description” is just used to help you differentiate them.

Important "Scope" is a user defined String that must be all lowercase with no spaces.

Billboards

Displaying marketing content requires a "Billboard". A Billboard is like an empty frame into which the SDK can place content it receives from the server in response to a Milestone. Like Milestone events, each Billboard is associated with a Scope. Upon receiving an event, the server will send marketing content applicable to the Scope of that Milestone, which are eligible for the Billboard with matching Scope. This allows for control of when and where the content is created.

After Billboards are implemented within the application, a Campaign will need to be created in the dashboard before content will be shown.

To create a Billboard, add the following code where you feel appropriate to prepare a Billboard or to the onResume() of an Activity or Fragment:

UpsightBillboard.Handler handler = UpsightBillboardHandlers.forDefault(activity);
UpsightBillboard billboard = UpsightBillboard.create(mUpsight, scope, handler);

The Billboard created should be destroyed in the onPause() by calling billboard.destroy() to avoid unintended UI transitions. You cannot create two Billboards with the same scope unless the first one has been destroyed, or it has completed the lifecycle of displaying a unit of marketing content, in which case it is unregistered by the system and its handler.onDetach() callback has occurred.

The handler allows the client to be notified of Billboard lifecycle events when an eligible marketing content becomes available. The UpsightBillboardHandlers class provides default implementations, but the client may provide custom implementations by subclassing the defaults, or directly implementing the UpsightBillboard.Handler interface. For example, the client may wish to temporarily disable a Billboard. To accomplish this, return null when handler.onAttach() is called to skip over any marketing content that becomes available during that time.

Additionally, if you would like to check that content is ready to display before opening a billboard, you can use the isContentReady method. This method will only return true if milestone is invoked with the corresponding scope and content has been received from the server.

Tip: The permission requirement android.permission.INTERNET is automatically merged to your application Manifest.

Getting Started

Managed Variable Module


Upsight Managed Variables allow you to create and use values in your app that are later configurable on the Upsight Dashboard. This allows you to create new and unique experiences for your users without releasing a new version of your app to the Play Store.

To use the Upsight Managed Variables, you first need to include the Managed Variable Module as a dependency.

Then you must follow the instructions in the Managed Variables section.

Getting Started

Google Advertising ID Module


To use the Google Advertising ID extension, you just need to include the module as a dependency, and the extension will automatically register with the system to supply the Google Advertising ID from Google Play as needed.

Push

Prerequisites


GCM Project Number and API Key

To obtain a Google Cloud Messaging (GCM) API key and Sender ID, you will have to create a Firebase project with Google.

  1. Visit the Google Firebase console and Create a New Project [or select an exisiting project] and follow the steps.

    Create Project

    Note It is not necessary to add the google-services.json file to your Android app module root directory to integrate Upsight Push notifications.

  2. Once you have created a new Android application, at the top left of the page select the Gear and go to Project Settings.

    Project Settings

  3. From the top, select Cloud Messaging tab, and save the Legacy Server key and Sender ID under Project credentials. GCM Key

  4. Save the two important pieces of information:

    • Legacy Server Key – will be used as a Google Cloud Messaging (GCM) API key, used in the Upsight Dashboard

    • Sender ID – will be used as a GCM Sender ID, used in the Android Manifest

  5. Use the Server key in your Upsight Dashboard, and your Sender ID when you configure your application.

More information on how to use the Server key in the Upsight Dashboard here.

Push

Google Push Services Module


Integration with Push is simple. To use the Google Push Services extension, add the following in your application Manifest:

<permission
    android:name="APPLICATION_PACKAGE_NAME.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<!-- e.g. android:name="com.yourCompany.yourApplication.permission.C2D_MESSAGE" -->
<uses-permission android:name="APPLICATION_PACKAGE_NAME.permission.C2D_MESSAGE" />
<application>

    <!-- e.g. android:value="com.yourCompany.yourApplication.0123456789" -->
    <meta-data
        android:name="com.upsight.gcm"
        android:value="APPLICATION_PACKAGE_NAME.GCM_SENDER_ID" />
    <receiver
        android:name="com.upsight.android.googlepushservices.internal.PushBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />

            <!-- e.g. android:name="com.yourCompany.yourApplication" -->
            <category android:name="APPLICATION_PACKAGE_NAME" />
        </intent-filter>
    </receiver>
</application>

Applications build for Oreo and later (API level 26 and above) running on Oreo will now use notification channels. By default, the SDK will create a channel with channel id com.upsight.push_channel.default with channel name Announcements. This name can be changed by adding a meta-data key com.upsight.push_channel.default.name into your manifest for example:

        <meta-data
            android:name="com.upsight.push_channel.default.name"
            android:value="Upsight Example Channel Name" />

If you would like to display marketing content delivered via a push message, create an UpsightPushBillboard in your launch Activity's onResume() and call billboard.destroy() in the onPause():

UpsightBillboard.Handler handler = UpsightBillboardHandlers.forDefault(activity);
UpsightBillboard billboard = UpsightPushBillboard.create(mUpsight, handler);

Tip: The permission requirements android.permission.INTERNET, android.permission.GET_ACCOUNTS, android.permission.WAKE_LOCK, and com.google.android.c2dm.permission.RECEIVE are automatically merged to your application Manifest.

Push

Handling a Push to a Custom URI


Sending a Push from the Upsight Dashboard allows you to direct a user to a custom URI. A custom URI can be an arbitrary URI like a browser URL, Google Play URI, or deep-link for Facebook. A custom URI can also allow you to execute specific behaviour based on your URI parameters. If you send a URI that the device cannot handle because there is no registered Intent Filter, an error message will be logged to ADB, but no notification will be shown.

If you wish to handle a custom URI within your app, you will need to declare an Intent Filter on an Activity in your Manifest. The following is an example of an application handling an Intent from a Push Notification with a custom URI.

<application>

    <!-- e.g. android:name="com.yourCompany.yourApplication.YourActivity" -->
    <activity android:name=".ACTIVITY_NAME">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <!-- e.g. android:host="my_host" -->
            <!-- e.g. android:scheme="my_scheme" -->
            <data
                android:host="HOST"
                android:scheme="SCHEME" />
        </intent-filter>
    </activity>
</application>

To have this Activity open when the user clicks your Push Notification, send a Push from the Upsight Dashboard with URL or URI selected as your action and with the following URI:

my_scheme://my_host/

Push

Customizing Push Notification Icons


You may optionally customize the appearance of Push Notifications by providing a customized NotificationCompat.Builder:

public class MyNotificationBuilderFactory implements UpsightPushNotificationBuilderFactory {

    @Override
    public NotificationCompat.Builder getNotificationBuilder(UpsightContext upsight, String title, String message, String imageUrl, String channelId, int priority) {
        int iconResId = R.drawable.my_push_icon;                 // Customize icon.
        String customTitle = String.format("Hey Jo, %s", title); // Customize title.

        return new NotificationCompat.Builder(upsight.getApplicationContext(), channelId)
                .setPriority(priority)
                .setSmallIcon(iconResId)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(message))
                .setContentTitle(customTitle)
                .setContentText(message);
    }
}

Then declare your UpsightPushNotificationBuilderFactory implementation in the application Manifest:

<!-- e.g. android:value="com.yourCompany.yourApplication.MyNotificationBuilderFactory" -->
<meta-data
    android:name="com.upsight.notification_builder_factory"
    android:value="FULL_CLASS_PATH_TO_YOUR_UPSIGHT_NOTIFICATION_BUILDER_FACTORY_IMPLEMENTATION" />

GDPR

Location


Upsight allows you to manually set both a user's home location and current location rather than relying on IP address. This is especially applicable for countries covered by the GDPR. If current or home country are manually set, they override any derived country information that would otherwise attribute a user to a specific country for reporting and targeting purposes.

Current Country

setCurrentCountry allows you to specify any 3-character country code to set as the user's current country. If you would like to clear this value, simply pass null.

getCurrentCountry returns the set current country string of the user or null if none was set.

Current country takes precedence over any derived country information (eg from IP).

Home country

setHomeCountry allows you to specify any 3-character country code to set as the user's home country. If you would like to clear this value, simply pass null.

getHomeCountry returns the set home country string of the user or null if none was set.

Home country takes precedence over current country and any derived country information.

Session Lifecycle Callbacks

Session Callbacks


To receive optional callbacks when an Upsight Session starts or resumes you must implement UpsightSessionCallbacks and specify its full class path in the Android Manifest:

<!-- e.g. android:value="com.yourCompany.yourApplication.MySessionCallbacks" -->
<meta-data
    android:name="com.upsight.session_callbacks"
    android:value="FULL_CLASS_PATH_TO_YOUR_UPSIGHT_SESSION_CALLBACKS_IMPLEMENTATION" />

There are four Upsight Session callbacks:

  1. onStart() is called when a new session is about to start. It is guaranteed to run before any event is recorded, so this gives an opportunity for the application to set initial event attributes. You must not create another UpsightContext here.

  2. onStarted() is called when a new session is created. You can call the full set of Upsight SDK APIs, except creating an UpsightContext.

  3. onResume() is called when an existing session is about to resume. It is guaranteed to run before any event is recorded, so this gives an opportunity for the application to set initial event attributes. You must not create another UpsightContext here.

  4. onResumed() is called when an existing session is resumed. You can call the full set of Upsight SDK APIs, except creating an UpsightContext.

You can also call UpsightSessionInfo.getLatest() any time to get information about the current session. If there is no running session, the method will return information about the last known session.

Content Callbacks

Content Callbacks


Important Please note the Content Callbacks are only available in Upsight SDK 4.7.1 and above.

To receive optional callbacks when a partner starts or content is available you must have a class that implements the UpsightMarketingContentStore.Listener interface.

There are three Upsight Content callbacks to implement:

  1. onPartnerInitialized() is called when a partner SDK has completed initializing. You can use this to know when its safe to call scopes that specifically use partner SDKs. Mediation, for example, would be known by the "fuse" partner string.

  2. onContentAvailable(String scope, Map<String, String> parameters) is called when content for a scope is available and ready to be displayed. You can use this callback to know exactly when to open a billboard to show content.

  3. onContentNotAvailable(String scope, Map<String, String> parameters) is called when content for a scope is not available such as if content failed to render due to a timeout. You can use this callback to retry requesting content for that scope.

In addition to implementing the interface methods, you must register the listener. To do so, call UpisghtMarketingContentStore.setListener(UpsightContext upsight, Listener listener). This can be done any time after you have created an UpsightContext. You can also clear the registered listener by calling UpsightMarketingContentStore.clearListener(UpsightContext upsight). Only one listener can be active at a time.

User Attributes

User Attributes


User attributes are global attributes sent with every event. To implement user attributes each one must be declared in the application Manifest as follows:

<!-- e.g. android:name="com.upsight.user_attribute.account_name" -->
<!-- e.g. android:value="default_account_name" -->
<meta-data
    android:name="com.upsight.user_attribute.ATTRIBUTE_TYPE.ATTRIBUTE_KEY"
    android:value="DEFAULT_VALUE" />

The android:name field specifies the key for the user attribute, while android:value indicates to the SDK the default value for that key. Valid types include: string, boolean, integer, float, and datetime. If the type is not specified, the SDK will infer a type from the default value. The default value for the boolean type is true or false, and datetime values are specified in GMT according to the format yyyy-MM-ddTHH:mm:ss (e.g. 1970-01-01T00:00:00). You can set 9999-12-31T23:59:59 to send null as the default value for the datetime type.

Now that these variables are declared, you can set values with UpsightUserAttributes.put() and get values with respective get methods: UpsightUserAttributes.getInteger(), UpsightUserAttributes.getBoolean(), UpsightUserAttributes.getFloat(), UpsightUserAttributes.getString(), UpsightUserAttributes.getDatetime().

In order to update the user attributes with their true values (i.e. for the particular user), we need to set these values before any event is recorded, so that all events will carry the proper values. This is achieved by setting the user attributes in a UpsightSessionCallbacks.onStart() implementation.

The Upsight SDK guarantees that the UpsightSessionCallbacks.onStart() is synchronously executed before any event is recorded, so this is the perfect opportunity to configure global attributes that need to be part of every event. For example, the following implementation sets the updated values for user attributes:

public class MySessionCallbacks implements UpsightSessionCallbacks {

    @Override
    public void onStart(final UpsightSessionContext upsight, final UpsightSessionInfo previousSessionInfo) {
        // Every event recorded will contain USER_ACCOUNT_NAME for the "account_name" user attribute.
        UpsightUserAttributes.put(upsight, "account_name", "USER_ACCOUNT_NAME");
    }

    ...
}

Lastly, you must declare your UpsightSessionCallbacks implementation in the application Manifest:

<!-- e.g. android:value="com.yourCompany.yourApplication.MySessionCallbacks" -->
<meta-data
    android:name="com.upsight.session_callbacks"
    android:value="FULL_CLASS_PATH_TO_YOUR_UPSIGHT_SESSION_CALLBACKS_IMPLEMENTATION" />

Once you have set User Attributes in your code, add it as a Custom Attribute in your dashboard under Settings > Applications > App name > Edit app > Custom Attributes. This will allow you to segment and create analytics using your User Attributes.

When creating Custom Attributes in the dashboard, select the type which matches the type defined in your Manifest. For String attributes, you may select string or a list of strings. string attributes allow you do store and match on a single item, for example, Team, City or Gender. A list of strings allows you to store a list of items and then create segments based on whether or not that list contains, or does not contain, specific items. This could be used to store a list of purchases, subscriptions, or other items, and is a more effective way to match against set which may contain lots of different items than creating individual boolean attributes, one for each item in the list. A list of strings should still be defined with the string type in your Manifest and should be composed by comma separating the items into a single string when you set the value.

Custom Attributes

Note You cannot programmatically add or remove User Attributes. They are specified with default values in the Android Manifest, and read or updated through the Java APIs. Adding and removing User Attributes will cause a discontinuity in your application's data, so it is something you should do only with forethought and planning.

Virtual Goods Promotion (VGP) and Rewards

Virtual Goods Promotion (VGP) and Rewards


Granting Rewards and VGP Purchases

Virtual Goods Promotions (VGP) and Rewards are two types of content that can be set up through the dashboard and displayed in a billboard. These are different from other content units in that you, as a programmer, need to know whether or not the customer has accepted the offer.

In the event your user receives a reward or purchasable virtual good, you are notified through one of two optionally implemented methods from the UpsightBillboard.Handler:

void onPurchases(List<UpsightPurchase> purchases);

void onRewards(List<UpsightReward> rewards);

By providing an implementation for one or both of these methods, your code is given the opportunity to take appropriate action based on what your user has done.

In the case of a VGP, it is likely you will need to broker a transaction between your user and Google Play or some other store. Once that transaction is finished you can track the results using a UpsightMonetizationIapEvent or UpsightMonetizationEvent. See the UpsightGooglePlayHelper if your store is Google Play.

See below for a sample implementation of the onPurchases and onRewards methods.

private static class MyBillboardHandler extends UpsightBillboardHandlers.DefaultHandler {

    private final Context mContext;

    private MyBillboardHandler(Activity activity) {
        super(activity);

        // It is important that you do not keep a strong reference to the Activity, but only use
        // the Application Context in your callback implementations, because there is no
        // guarantee the current Activity will be present when these callbacks are triggered.
        mContext = activity.getApplicationContext();
    }

    @Override
    public void onPurchases(List<UpsightPurchase> list) {
        for (UpsightPurchase purchase : list) {
            String text = "Purchase received: " + purchase.getProduct() + " x " + purchase.getQuantity();
            Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void onRewards(List<UpsightReward> list) {
        for (UpsightReward reward : list) {
            String text = "Reward received: " + reward.getProduct() + " x " + reward.getQuantity();
            Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
        }
    }
}

Important Please note that the Reward Product provided by Upsight to your application will be in lower case and can only contain alphanumeric characters and underscores.

Validating Rewards

Upsight offers you the ability to callback directly to your server when a reward is granted for validation or to send over reward data from your device. You can read about configuring server to server reward callbacks here as well as validating Upsight sent messages here.

If you would like to validate the reward that the Upsight server has granted to the device, you can do so by sending reward signature data to your server and performing an operation on the contents. You can get the signature data JSON by calling UpsightReward.getSignatureData().

This JSON object contains the product, sid, quantity, nonce, and signature of the reward. You use the product, sid, quantity, and nonce along with your app's secret_key to produce the signature provided in the payload on your server.

Below is a python example of reward verification:

import base64
import hashlib
import hmac


def validate_signature_data(signature_data, secret):
    """Validates the signature for Upsight rewards.

    >>> secret = 'YOUR_32_CHAR_SECRET_KEY'
    >>> signature_data = {
    ...     'idfv': 'AAAAAAAA-0000-0000-0000-000000000000',
    ...     'nonce': '0437121572:rambo_cat:1',
    ...     'product': 'rambo_cat',
    ...     'quantity': 1,
    ...     'sid': '10000000000000000000',
    ...     'sig4': 'joQiupsyEe10Ui83TCPuScVBfOo',
    ...     'token': 'YOUR_APP_TOKEN'
    ... }
    >>> validate_signature_data(signature_data, secret)

    If the signature is invalid, or there is a problem with the signature_data
    dictionary, ValueError will be raised:

    >>> signature_data['sig4'] = 'invalid'
    >>> validate_signature_data(signature_data, secret)
    Traceback (most recent call last):
      ...
    ValueError: incorrect signature

    :param dict signature_data: A dictionary of signature data, from the SDK.
    :param str secret: Your app secret string.
    :raises ValueError: if the signature is invalid.
    """
    for required in ('nonce', 'sig4', 'token'):
        if required not in signature_data:
            raise ValueError('signature_data is missing {}'.format(required))

    identifiers = {}
    for identifier in ('device', 'gid', 'ifa', 'mac', 'odid', 'odin',
                       'idfv', 'sid'):
        value = signature_data.get(identifier)
        if not value:
            continue
        if isinstance(value, unicode):
            value = value.encode('utf8')
        identifiers[identifier] = value
    if not identifiers:
        raise ValueError('signature_data is missing identifiers')

    message = ':'.join((':'.join(str(identifiers[key])
                                 for key in sorted(identifiers.keys())),
                        signature_data['token'],
                        signature_data['nonce']))
    signature_hash = hmac.new(str(secret), message, hashlib.sha1)
    signature = base64.urlsafe_b64encode(signature_hash.digest()).rstrip('=')
    if not hmac.compare_digest(signature_data['sig4'], signature):
        raise ValueError('incorrect signature')

Native Messaging

Overview


Native Messaging lets you leverage Upsight’s Segmentation and Targeting to deliver campaigns where you can implement your own native display, instead of using one of Upsight’s interstitial campaigns.

Note Native Messaging is supported on Upsight SDK versions 4.4.0 and above.

Native Messaging campaigns are delivered through Milestones and Billboards as with our other campaigns types, plus your own handling of the returned data. See the Milestones and Billboards section for the core concepts, and the below instructions for the additional steps required to start using Native Messaging.

Native Messaging campaigns are designed to create native experiences by collecting the inputs required to build a desired experience then sending that data to the correct devices at the correct times. Before a Native Messaging campaign is published, the application source code will need to be updated to handle and/or display the expected payload inputs. Once a campaign has been triggered and a payload has been passed back, it is up to the developer to have the infrastructure in place to handle and display their intended experience. This responsibility includes using Upsight provided helper methods and objects to track events such as clicks and impressions, as well as controlling the destruction of campaign content.

The Upsight SDK provides several methods to access the data contained in a payload and will return native objects when possible. These accessor methods are made available through UpsightData objects. UpsightData objects are an Upsight created object type with numerous Native Messaging specific capabilities. When a Native Messaging campaign is triggered, a UpsightData object will be returned through a delegate method, where the developer can then access the contents of the UpsightData object and build their experience.

Important Images are handled differently than the other supported data types. Images sent in a Native Messaging campaign are pre-fetched and stored on disk in order to reduce latency when rendering an image once a milestone is triggered. Pre-fetched images are accessed via a file path and can be handled in your source code using a UpsightData.Image object along with the provided helper methods.

Native Messaging

Integrate For Native Messaging


Receiving Data From a Native Messaging Campaign

In the source file in which you would like to access a Native Messaging payload, simply import the marketing module.

Implement the onData callback in your UpsightBillboard.Handler in order to access your Native Messaging payload. This method will get called when a campaign with a native message payload is received. While the billboard itself will not render any content, it is still used to make the payload available.

public void onData(UpsightData data) {

}

Accessing Content in a Native Messaging Campaign Object

UpsightData objects provide instance methods to access the different types of objects contained in the native message.

Accessor method signatures for payloads generated using the Basic input format:

String getString(String tag);
Boolean getBoolean(String tag);
Integer getInt(String tag);
Float getFloat(String tag);
Color getColor(String tag);
Image getImage(String tag);

UpsightData.Color is an object that provides an RGB colorString in RRGGBBAA format, the integer representation of the colour in intValue. as well as a helper function toARGB to translate the string colorString to AARRGGBB format.

UpsightData.Image is an object that contains properties for the image's loaded-on-disk file path, width, and height. Please use this information to load the image into memory and display it as you see fit.

Native Messages created using the ‘Raw’ input method will can be accessed via the getRawData method. This method provides a dictionary containing raw data in the same structure and format as entered in the campaign on the Upsight Dashboard.

JSONObject getRawData();

Important After the billboard containing the native message is destroyed, all data associated with the returned UpsightData will be removed. For UpsightData.Image objects, this means that the image on disk that is being referenced will be deleted. Please make a separate local copy of any images that you would like to persist past the life of the billboard.

Tracking User Interaction

Once the Native Messaging campaign is ready to be displayed to the user, the interaction the user has with the campaign can be tracked by calling various methods on your USDataPayload object. The available methods are:

  1. void recordImpressionEvent(); - Send this once the content of the campaign is rendered and displayed to the user.
  2. void recordClickEvent(); - Send this if the user interacts with your campaign such as accepting a dialog prompt.
  3. void recordDismissEvent(); - Send this once the campaign is no longer on screen.
  4. void destroy(); - Send once the payload is no longer needed, e.g. after the dismiss button has been pressed or after a user has performed the desired action. This method must be called to inform the SDK that the content interaction is finished.

Important If a campaign is not intended to be seen by users, simply call destroy() on the payload once it has been processed by the application.

Native Messaging

Example


Here is a sample implementation of a Native Messaging campaign used to render a native interstitial within an application.

In order to have this example display the campaign on a device, a Native Messaging campaign was created on the dashboard by with the following inputs:

example screenshot 1

As well, to handle the expected payload from the Native Messaging campaign, the below implementation was added to the Activity intended to render the campaign:

private UpsightData mData = null;

private class NativeMessageHandler extends UpsightBillboardHandlers.DefaultHandler {

    public NativeMessageHandler(Activity activity) {
        super(activity);
    }

    @Override
    public void onData(UpsightData data) {
        // Cache data payload.
        mData = data;

        // Show dialog fragment from data payload.
        NativeMessageFragment.newInstance(data.getString("BodyCopy"),
                data.getColor("BGColor").intValue,
                data.getImage("OrnamentImage").path,
                data.getImage("OfferImage").path)
                .show(getFragmentManager(), "native_message_fragment");
    }

    @Override
    public void onDetach() {
        // Release data payload.
        mData = null;
    }
}

public static class NativeMessageFragment extends DialogFragment {

    static NativeMessageFragment newInstance(String bodyCopy,
                                             int bgColorIntValue,
                                             String ornamentImagePath,
                                             String offerImagePath) {
        Bundle args = new Bundle();
        args.putString("bodyCopy", bodyCopy);
        args.putInt("bgColorIntValue", bgColorIntValue);
        args.putString("ornamentImagePath", ornamentImagePath);
        args.putString("offerImagePath", offerImagePath);

        NativeMessageFragment fragment = new NativeMessageFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        // Record impression event.
        final UpsightData data = getDataPayload();
        if (data != null) {
            data.recordImpressionEvent();
        }

        // Create dialog from data payload.
        final Bundle args = getArguments();
        final View view = getActivity().getLayoutInflater()
                .inflate(R.layout.native_message_fragment, null);
        view.setBackgroundColor(args.getInt("bgColorIntValue"));
        ((ImageView) view.findViewById(R.id.offer_image))
                .setImageBitmap(BitmapFactory.decodeFile(args.getString("offerImagePath")));
        return new AlertDialog.Builder(getActivity())
                .setIcon(new BitmapDrawable(getResources(), args.getString("ornamentImagePath")))
                .setTitle(args.getString("bodyCopy"))
                .setView(view)
                .create();
    }

    @Override
    public void onDismiss(DialogInterface dialog) {
        super.onDismiss(dialog);

        // Record dismiss event and destroy.
        final UpsightData data = getDataPayload();
        if (data != null) {
            data.recordDismissEvent();
            data.destroy();
        }
    }

    private UpsightData getDataPayload() {
        MyActivity activity = (MyActivity) getActivity();
        if (activity != null) {
            return activity.mData;
        }
        return null;
    }
}

When a user reaches the appropriate milestone your Native Messaging payload will be delivered to the device. If handled correctly by the source code, the campaign creative will render an experience like this:

example screenshot 2

Native Messaging

Testing a Native Messaging Campaign


Once a native messaging campaign is configured in the dashboard and the application is set up to handle native messaging payloads simply trigger a milestone with the scope of the campaign and open a billboard. Depending on the implementation, the campaign should render and, when clicked, a content displayed, dismissed, and click should display in Upsight RealTime.

Upsight Ad Mediation

Prerequisites


Setting Up Upsight Ad Mediation

In order to set up the Upsight Ad Mediation SDK, you will need to have Upsight Ad Mediation added to your account and be on SDK version 4.1.3 or later. Contact your customer success manager for more information.

Upsight SDK Integration

Upsight Ad Mediation can only be used in conjunction with the base Upsight SDK and will show rewarded and non-rewarded video ads through billboards and milestones. Make sure you have completed the basic integration of the Upsight SDK including billboards and milestones before you begin integrating Upsight's Ad Mediation SDK.

Upsight Ad Mediation

Integration


Dependencies

To add mediation to your Upsight SDK integration, simply add the following dependency to your integration:

compile 'com.upsight.android:mediation:4.9.2'             // To use the Mediation module.

Upsight Ad Mediation

Showing Mediated Video Ads


Non Rewarded Video Ads & Static Interstitials

Once you have added the SDK, you will be able to show a mediated video ad or static interstitial at any billboard. Simply go to your Upsight Dashboard and create an Ad Campaign targeting a specific milestone. See the Creating Mediated Ad Campaigns section for more information.

Rewarded Video Ads

Simply implement handling rewards and you will be able to grant your users rewards when running a Rewarded Video Ad campaign at any billboard for a given milestone scope.

Make sure to add the rewards to the dashboard. See Adding Rewards for more information.

Monetization

Monetization


If you wish to track an in-app purchase that is processed through the Google Play Store, use the following API from the UpsightGooglePlayHelper, which extracts receipt information for our servers to verify the transaction with Google:

UpsightGooglePlayHelper.trackPurchase(mUpsight, quantity, currency, price, totalPrice, product, responseData, publisherData);
  • mUpsight - The Upsight Context.

  • quantity - The number of products purchased during the transaction.

  • currency - The currency as a 3-character ISO 4217 code.

  • price - The price per unit in local currency.

  • totalPrice - The total price of the transaction, including fractional amounts of the currency, before store fees have been taken into account.

  • product - The product ID of the Google Play in-app product.

  • responseData - The purchase response data from onActivityResult(). See Google Play In-app Billing Version 3 API.

  • publisherData - Optional custom parameter bundle.

Note If you would like your IAP data to be validated, first upload your Google Play License Key to Upsight Dashboard.

App Settings Dashboard

This can be found by navigating to the Upsight Dashboard in the App Settings page. (Applications > YOUR_APPLICATION > App Settings > Edit App > Google Play License Key).

If you have a purchase to record that did not involve the Google Play store, you can use the following code below to record a Monetization Event, where no receipt verification will be performed:

UpsightMonetizationEvent
    .createBuilder(totalPrice, currency)  // Required event properties.
    .setProduct("product.name")           // Optional event property.
    .put(customBundle)                    // Custom property bundle.
    .put(customKey, customValue)          // Custom property override.
    .record(mUpsight);                    // Record event.

Location Tracking

Location Tracking


Enabling location tracking will allow you to target and segment your users based on their geographical location.

To add location tracking, add the following to the onStart() of your UpsightSessionCallbacks implementation:

public class MySessionCallbacks implements UpsightSessionCallbacks {

    @Override
    public void onStart(final UpsightSessionContext upsight, final UpsightSessionInfo previousSessionInfo) {
        // You may call getSystemService() from the UpsightContext instance since it just wraps the android.content.Context.
        LocationManager locationManager = (LocationManager) upsight.getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
        if (ActivityCompat.checkSelfPermission(upsight.getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED
                && ActivityCompat.checkSelfPermission(upsight.getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
                && locationManager != null) {
            List<String> matchingProviders = locationManager.getAllProviders();
            for (String provider : matchingProviders) {
                Location location = locationManager.getLastKnownLocation(provider);
                if (location != null) {
                    UpsightLocationTracker.Data data = UpsightLocationTracker.Data.create(location.getLatitude(), location.getLongitude());
                    UpsightLocationTracker.track(upsight, data);
                    break;
                }
            }
        }
    }

    ...
}

Lastly, you must declare your UpsightSessionCallbacks implementation in the application Manifest:

<!-- e.g. android:value="com.yourCompany.yourApplication.MySessionCallbacks" -->
<meta-data
    android:name="com.upsight.session_callbacks"
    android:value="FULL_CLASS_PATH_TO_YOUR_UPSIGHT_SESSION_CALLBACKS_IMPLEMENTATION" />

Tip: You can combine user attributes and location tracking into one UpsightSessionCallback.

Managed Variables

Defining Managed Variables


To begin, you must create a JSON file in a raw folder in your application's res folder. Name the JSON file uxm_schema.json with a structure as indicated in the following section:

[
  {
    "tag": "enable_extended_mode",
    "description": "Flag which allows to enable extended mode",
    "type": "boolean",
    "default": true
  },
  {
    "tag": "personage_name",
    "description": "Default name for personage",
    "type": "string",
    "default": "Bob"
  },
  {
    "tag": "personage_coins",
    "description": "Number of coins available for personage",
    "type": "integer",
    "default": 2000,
    "min": 0,
    "max": 10000
  },
  {
    "tag": "personage_strength",
    "description": "Default strength for personage",
    "type": "float",
    "default": 0.5,
    "min": 0,
    "max": 1
  }
]

As above, this file will contain an array of JSON objects with the following keys:

  • default: the default value of a variable. Can be of type string, integer, float, or boolean.
  • description - A description of what the variable is to be used for.
  • tag - The string by which you will reference the variable in your code.
  • type - The type of the variable as it will be indicated on the Upsight Dashboard. Valid values are the strings string, boolean, integer, and float.
  • min - The minimum value this integer or float variable can have.
  • max - The maximum value this integer or float variable can have.

Managed Variables

Accessing Managed Variables


Once your variables are declared, you can then access them from your code by calling one of the below UpsightManagedVariable methods based on the type of variable you have stored:

  • UpsightManagedString.fetch(UpsightContext upsight, String tag);
  • UpsightManagedInt.fetch(UpsightContext upsight, String tag);
  • UpsightManagedFloat.fetch(UpsightContext upsight, String tag);
  • UpsightManagedBoolean.fetch(UpsightContext upsight, String tag);

The returned object will have a get method appropriate to its type which gives you the most recent value returned from the server. See below for a full code example:

String tag = "personage_name";
UpsightManagedString managedPersonageName = UpsightManagedString.fetch(mUpsight, tag);
Log.d(LOG_TAG, managedPersonageName.get());

The above fetch APIs return an UpsightManagedVariable synchronously, which means they will block on a database read and should not be called from the main thread. To perform asynchronous reads you can use the following methods:

  • UpsightManagedString.fetch(UpsightContext upsight, String tag, Listener<UpsightManagedString> listener);
  • UpsightManagedInt.fetch(UpsightContext upsight, String tag, Listener<UpsightManagedInt> listener);
  • UpsightManagedFloat.fetch(UpsightContext upsight, String tag, Listener<UpsightManagedFloat> listener);
  • UpsightManagedBoolean.fetch(UpsightContext upsight, String tag, Listener<UpsightManagedBoolean> listener);

In either case, after you retrieve the UpsightManagedVariable object, calling get() on that object will get you the most updated value synchronously. See below for a code example:

String tag = "personage_name";
UpsightManagedString.fetch(mUpsight, tag, new UpsightManagedVariable.Listener<UpsightManagedString>() {
    @Override
    public void onSuccess(UpsightManagedString managedPersonageName) {
        Log.d(LOG_TAG, managedPersonageName.get());
    }

    @Override
    public void onFailure(UpsightException e) {
        Log.e(LOG_TAG, e.getMessage());
    }
});

The UpsightManagedVariable objects also implement java.util.Observable, so you may subscribe to them to be notified of when the underlying value is updated. The following example adds a java.util.Observer to the synchronous fetch call.

String tag = "personage_name";
final UpsightManagedString managedPersonageName = UpsightManagedString.fetch(mUpsight, tag);
managedPersonageName.addObserver(new Observer() {
    @Override
    public void update(Observable observable, Object data) {
        Log.d(LOG_TAG, managedPersonageName.get());
    }
});

The following examples adds a java.util.Observer to the asynchronous fetch call.

String tag = "personage_name";
UpsightManagedString.fetch(mUpsight, tag, new UpsightManagedVariable.Listener<UpsightManagedString>() {
    @Override
    public void onSuccess(final UpsightManagedString managedPersonageName) {
        managedPersonageName.addObserver(new Observer() {
            @Override
            public void update(Observable observable, Object data) {
                Log.d(LOG_TAG, managedPersonageName.get());
            }
        });
    }

    @Override
    public void onFailure(UpsightException e) {
        Log.e(LOG_TAG, e.getMessage());
    }
});

Managed Variables

Managed Variable Callback Handler


By default, the SDK will update the managed variable values whenever the server sends updates, but you may wish to observe when synchronization is complete, or skip updates during times when you need the managed variable values to be stable. You can hook into the synchronization flow by registering a UpsightUserExperience.Handler in your UpsightSessionCallbacks.onStart():

public class MySessionCallbacks implements UpsightSessionCallbacks {

    @Override
    public void onStart(final UpsightSessionContext upsight, final UpsightSessionInfo previousSessionInfo) {
        // Register handler for user experience bundles.
        UpsightUserExperience.registerHandler(upsight, new UpsightUserExperience.Handler() {

            @Override
            public boolean onReceive() {
                // Implement logic to decide whether to apply managed variable changes.
                // This will execute whenever a new user experience bundle arrives. 
                return true;
            }

            @Override
            public void onSynchronize(List<String> tags) {
                // If onReceive() returned true, this callback ensures all managed variables are
                // now synchronized with the server. If the new user experience bundle is
                // skipped with onReceive() returning false, the managed variable values will
                // still hold the last-known local values.
            }
        });
    }

    @Override
    public void onStarted(final UpsightContext upsight) {
        // Do nothing.
    }

    @Override
    public void onResume(final UpsightSessionContext upsight, final UpsightSessionInfo resumedSessionInfo) {
        // Do nothing.
    }

    @Override
    public void onResumed(final UpsightContext upsight) {
        // Do nothing.
    }
}

Warning The application will not receive UpsightUserExperience.Handler callbacks if the device has no network connectivity.

Attribution Tracking

Setting Attribution Source


Upsight SDK version 4.2.0 and above will automatically pull in attribution sources from the Google Play Store.

If you would like to manually set your attribution source, you can do so through through the use of the UpsightInstallAttributionEvent method:

                    UpsightInstallAttributionEvent.createBuilder()
                            .setAttributionSource(source)
                            .setAttributionCampaign(campaign)
                            .setAttributionCreative(creative)
                            .record(upsight);

Helper Methods

isContentReady


Description

Returns true if there is content ready for a given scope.

Example

UpsightMarketingContentStore.isContentReady(mUpsight, scope)

Helper Methods

getSid


Description

Invoke this method to get your Sid. Sid is an internal user identifier Upsight uses. In situations, you may want to use this identifier for your own internal purposes or store it on your servers.

Example

mUpsight.getSid();

Helper Methods

getLatestSessionInfo


Description

Gets information about the latest Upsight session.

Example

UpsightSessionInfo.getLatest(mUpsight)

Best Practice for Testing

Best Practice for Testing


To maintain the data integrity of your metrics, it is important to keep your production data in Upsight clean. To do this just takes a few steps.

First create test and production applications in the Upsight Dashboard and note each application’s Token and Public Key. Then edit your application Manifest as follows:

<application>
    <meta-data
        android:name="com.upsight.app_token"
        android:value="@string/com_upsight_app_token" />
    <meta-data
        android:name="com.upsight.public_key"
        android:value="@string/com_upsight_public_key" />
</application>

Finally edit your application's build.gradle, and add the following string resources in the android{} section. Replace the placeholders for your tokens and public keys as appropriate.

android {
    buildTypes {
        debug {
             resValue "string", "com_upsight_app_token", "UPSIGHT_DEVELOPMENT_APPLICATION_TOKEN"
             resValue "string", "com_upsight_public_key", "UPSIGHT_DEVELOPMENT_PUBLIC_KEY"
        }
        release {
             resValue "string", "com_upsight_app_token", "UPSIGHT_PRODUCTION_APPLICATION_TOKEN"
             resValue "string", "com_upsight_public_key", "UPSIGHT_PRODUCTION_PUBLIC_KEY"
        }
    }
}

Finding Device Identifiers

How to find your Android ID


Important Please keep in mind that from Android 8.0+ (Oreo or higher), Google has changed how Android Id's are generated to be unique per application (even for the same user).

Per Google :

The value of ANDROID_ID is unique for each combination of app-signing key, user, and device. As a result, apps with different signing keys running on the same device no longer see the same Android ID (even for the same user).

Using Real Time

The easiest way to get a device's Android ID is by using Real Time in your dashboard once your app is integrated with the Upsight SDK.

Simply click on an event and search for ids.android_id. The Android ID will be a string of alphanumeric characters so it will look something like bedb0ff7a69ddf5b.

Using logcat

  1. Connect your device to your computer via USB cable.
  2. Check the console log on your computer. You can do this using logcat
  3. Open the app that you have integrated the Upsight SDK with.
  4. Search for ids.android_id in the logs.

By searching for the ids.android_id parameter in the console log, you can find the Android ID. The Android ID will be a string of alphanumeric characters so it will look something like bedb0ff7a69ddf5b.

Using an App

  1. Download the free app, Android System Info, from Google Play
  2. Visit the 'System' tab at the top.
  3. Look for the Android ID listed in the OS subsection.

Dependencies

Base Dependencies


All modules in the Upsight Android SDK share the following dependencies. They are automatically included in your APK.

  • io.reactivex:rxandroid:1.1.0
  • io.reactivex:rxjava:1.1.3
  • commons-io:commons-io:2.4
  • com.google.code.gson:2.6.2
  • com.squareup:otto:1.3.8
  • com.google.dagger:dagger:2.14
  • javax.inject:javax.inject:1

Note The all bundle contains all transitive dependencies above, as well as each transitive dependency of the Analytics Module, Marketing Module, Google Advertising ID Module, and Google Push Services Module.

Dependencies

Analytics Module Dependencies


Aside from the base dependencies, the Analytics Module has no additional dependencies.

Dependencies

Marketing Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Marketing Module in your project.

  • com.upsight.android:analytics:4.9.2
  • com.upsight.android:mediation-common:2.12.1
  • com.upsight.android:mediation-ad-network-vast:2.12.1
  • com.upsight.android:mediation-ad-network-mraid:2.12.1

Dependencies

Managed Variables Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Managed Variables Module in your project.

  • com.upsight.android:analytics:4.9.2

Dependencies

Google Advertising ID Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Google Advertising ID Module in your project.

  • com.upsight.android:marketing:4.9.2
  • com.android.support:support-v4:24.0.0
  • com.google.android.gms:play-services-ads:10.2.1
  • com.google.android.gms:play-services-basement:10.2.1

Dependencies

Google Push Services Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Google Push Services Module in your project.

  • com.upsight.android:marketing:4.9.2
  • com.android.support:support-v4:24.0.0
  • com.google.android.gms:play-services-gcm:10.2.1
  • com.google.android.gms:play-services-base:10.2.1
  • com.google.android.gms:play-services-basement:10.2.1
  • com.google.android.gms:play-services-measurement:10.2.1
  • com.android.volley.volley:1.0.0

Dependencies

Marketplace Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Marketplace Module in your project.

  • com.upsight.android:analytics:4.9.2

Dependencies

Mediation Module Dependencies


Along with the base dependencies, the following dependencies are automatically included in your APK if you include the Mediation Module in your project.

  • com.upsight.android:marketing:4.9.2
  • com.upsight.android:marketplace:4.9.2
  • com.upsight.android:mediation-core:2.12.1
  • com.android.support:support-v4:24.0.0
  • com.google.android.gms:play-services-ads:10.2.1
  • com.google.android.gms:play-services-basement:10.2.1

COPPA

COPPA


If you operate a mobile app directed to children under 13 that collects, uses, or discloses personal information from children or you otherwise have actual knowledge that you are collecting, using, or disclosing personal information from children under 13, the Children’s Online Privacy Protection Act (COPPA) may apply to you. If so, you may have responsibilities relating to how you collect, disclose, or use personal information from such children.

To assist you in your data collection, disclosure and use compliance obligations, we have added to the platform a new “opt-out“ setting to the Android SDK, so you can indicate whether you want Upsight to limit data collection and use, and serve only contextually targeted ads.

Child-directed settings and features

  • A default value for the opt-out flag in the SDK that can be changed by the publisher. The default value out-of-the-box will be opt_out = FALSE.
  • Functionality in the SDK to change the opt-out flag for the individual user. Publisher may use this setting if it utilizes age-gating functionality, for example.

Example

If you have an app that is directed at 8-10 year olds, you can set the default value for the opt-out flag to be TRUE for all users. Then, you can add an age-gating mechanism to the app, and change the opt-out flag to FALSE for users that you learn to be 13 or older.

Targeting Opt-Out

To comply with COPPA regulations and standards, Upsight has provided a mechanism for your app to opt-out of collecting user information. The user opt-out status inside your app is indicated by

UpsightOptOutStatus.get(UpsightContext upsight)
UpsightOptOutStatus.set(UpsightContext upsight, boolean setting)

The default opt-out status is set to FALSE. If you need to opt-out of collecting user information, simply call setOptOut() and set the value to TRUE.

Note Although Upsight has enabled this function, you are still responsible for providing an appropriate user interface for user opt-out.

For official information about COPPA, the recent amendments, and a list of FAQs provided by the FTC, please consult the FTC website.