Smartech

Product Experience

Begin setting up your Android app's Product Experience!

📘

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

Step 1: Complete basic setup

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

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>

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.**.* {*;}

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.

👍

Above analytics integrations, with exception of Smartech, 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 Smartech 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, Smartech 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: Advanced Features

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.

Updated 23 days ago


Product Experience


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.