Product Experience

Begin setting up your Android app's Product Experience!

📘

Product Experience is available for integration from CEE SDK v3.1.0 onwards.

Step 1: Complete basic setup

Go to Basic Setup to start integrating your Android project with CEE.

Step 2: Adding Dependency

  1. To install the latest Product Experience in your project, add the following line to the dependencies section in the app-level build.gradle
implementation 'com.netcore.android:smartech-nudges:<<nudge_sdk_android_version>>'
  1. Perform Gradle Sync to build your project and incorporate the dependency additions noted above.

Step 3: Add Hansel App ID and Hansel App Key

Add the following lines in AndroidManifest.xml.
Please get in touch with your account manager to get the value of <hansel_app_id> and <hansel_app_key>.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="<package-name>">

    <application>
            ...
        <meta-data
            android:name="HANSEL_APP_ID"
            android:value="<hansel_app_id>" />

        <meta-data
            android:name="HANSEL_APP_KEY"
            android:value="<hansel_app_key>" />
      ...
    </application>

</manifest>

Optional: To enable encryption for nudge SDK
If you wish to enable encryption of data in the nudge SDK, please add the below lines in the application's manifest file. . This encrypts the data that is stored locally on the device for evaluation of client-side segments. Please note that this option works on Android nudges SDK v8.7.0 onwards.

<meta-data
    android:name="SMT_USE_ENCRYPTION"
    android:value="true" />

Step 4: Setting up proguard rules

Add the following lines in proguard-rules.pro to retain Hansel files during the proguard process.

-dontwarn io.hansel.**
-keep class io.hansel.**{*;}
-keep class * implements io.hansel.**.* {*;}
-keep class * extends io.hansel.**.* {*;}

If you have custom views in your app, please add the following additional line to proguard-rules.pro

For example, below is the rule to ignore proguarding for the package com.netcore.views

-keep class com.netcore.views.** { *; }

Step 5: Using existing analytics events for triggers and goals

You can use the analytics events of any of the following vendors as triggers for the Product Experience. These events can also be used as goal events.

Please note that the goal events sent to these analytics providers will have the below system parameters in addition to parameters that you will configure. These can be used to filter goal events data specific to an interaction map name and branch where the user falls into.

{
  hsl_counter: "2" //this is counter of how many hsl_data keys are present
  hsl_data: "J01:0123321,J02:2355235" //format:InteractionMapNameHash:BranchId
  hsl_data1: "J03:0123321"
}

👍

Above analytics integrations, with exception of CEE, are local to the device and none of the PII Information is shared back to Netcore servers.

Setting up page load events
You may use page load/page view events as triggers for Product Experience. You can check here on how to set them up.

Send nudge events to your own analytics system
If you wish to get nudge events shared back to your own analytics system, please follow the steps given here.

Step 6: Audience targeting based on user profile data

Server-side segments
If you want to use server-side segments as the target audience - please follow the steps given for user tracking & event tracking.

This will send data back to the CEE servers and allow you to create segments based on user profile attributes & event payload data.

👍

We recommend that you implement user tracking step if you plan to use feedback nudges

Client-side user profile data
If you want to keep user profile data at the client-side and use this information to target specific user ids, please follow the below steps.

👍

Client side user profile data is local to the device and none of the PII Information is shared back to Netcore servers.

  • User ID
    This is a pre-defined attribute that can be the user's email id, account id, or any other identifier that you use to uniquely identify a user. If not set, CEE SDK will generate a device-specific unique string to uniquely identify the app user.
//Setting User ID
Hansel.getUser().setUserId("user_id");

//Reset everything
Hansel.getUser().clear();
//Setting User ID
Hansel.getUser().setUserId("user_id")

//Reset everything
Hansel.getUser().clear()
import {NativeModules} from 'react-native';

//Setting User ID
NativeModules.HanselUserRn.setUserId(userId);

//Reset User ID and all User attributes.
NativeModules.HanselUserRn.clear();
  • Custom Attributes

Custom Attributes allow you to target users based on any data that you want. For example, to set a value for a custom attribute called “age”, you need to do the following:

Hansel.getUser().putAttribute("age", 25);
Hansel.getUser().putAttribute("age", 25)
import {NativeModules} from 'react-native';

//For double attribute
NativeModules.HanselUserRn.putDoubleAttribute(key, value);

//For string attribute
NativeModules.HanselUserRn.putStringAttribute(key, value);

//For boolean attribute
NativeModules.HanselUserRn.putBooleanAttribute(key, value);

Step 7: Setting up Test Device

Hansel dashboard lets you create Test Devices for your Android apps. Devices that are a part of your Test Devices will receive changes made on Hansel immediately. For all other devices, the data is cached locally to provide high availability.

To learn more about setting up test devices, please click here

Step 8: Fire events from test device

Ensure that you fire the events which you added in Step 5, from a test device. This can be done by invoking all the flows within the app, where the events have been added.
Once you have done the above changes, selected events will contain information related to the interaction maps created on the Hansel dashboard.

Step 9: Using nudges feature

You are now done with all integration steps required for nudges. You can try setting up your first nudge by following the steps given here.

Also, check out advanced features for nudges below.

Defining Actions
Product Experience SDK can also invoke a method in the registered listener whenever an action has been triggered for a given nudge. You can add additional logic in this method to perform any relevant tasks related to the action.

To implement this, follow the steps given here.

Handling invisible containers
If there is an invisible container in your app, you need to follow the steps given here for Product Experience SDK to ignore that container.

Setting up nudges on dynamic content
If your app has dynamic content populated in the ViewPager fragments or Recycler view and you want to anchor nudges on such views, then follow the below steps given here.

Step 10: Using A/B testing & feature management

To implement integration steps related to A/B testing and Feature Management - follow the steps given here.

Our SDK helps you to decouple product experiences from code on your app in real-time with product variables. These product variables lets you change the behavior as well as the appearance of the app without requiring users to download an app update.


Did this page help you?