Product Experience

Begin setting up your Android app's Product Experience!

πŸ“˜

Note

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

If Jetpack Compose is not used in Android project then add the following line to the dependencies section in the app-level build.gradle.

implementation 'com.netcore.android:smartech-nudges:10.2.0'

OR
If Jetpack Compose is used in Android project then add the following line to the dependencies section in the app-level build.gradle.

implementation β€˜com.netcore.android:smartech-nudges-compose:10.5.0’

Note: 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: Setup Proguard Rules

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: Use 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.

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"
}

πŸ“˜

Note

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.

πŸ“˜

Best Practices:

  • We recommend to implement page load events instead of using click actions for respective screens where you want to place the nudge.
  • If your app has splash screen, we recommend to create custom homepage load event instead of using app load event for showing nudge on homepage.

Send Nudge Events to your 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.

πŸ“˜

Note

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.

πŸ“˜

Note

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: Setup 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, 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: Advanced Nudges Features

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.

Setup 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.

Set App Default Font for Nudge Text

For setting a custom font, create a folder named src/main/assets and place font files (.ttf files) inside. Then, include the following code to apply the custom font.

//Set custom font via typeface
Typeface font = Typeface.createFromAsset(this.getAssets(), "font/svn_gilroy_regular.otf");
Hansel.setTypeface(font);

//OR 
//To use App Default Fonts
Hansel.setAppFont("Roboto");

//To Reset the font
Hansel.setAppFont("");
//Set custom font via typeface
val font = Typeface.createFromAsset(this.assets, "robotobold.ttf")
Hansel.setTypeface(font)

//OR
//To use App Default Fonts
Hansel.setAppFont("Roboto");

//To Reset the font
Hansel.setAppFont("");

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.