Smartech

Product Experience

Begin setting up your iOS app's Product Experience!

📘

  • Product Experience SDK is available for integration from Smartech SDK v3.1.0 onwards.
  • Smartech Product Experience SDK only supports Xcode 11 and above.

Step 1: Complete basic setup

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

Step 2: Add Hansel to podfile

  1. Cocoapods initialization

Open terminal, go to the project directory and run the following command:

pod init

This will create a podfile in your project directory.

  1. Add Smartech-Nudges to target

In the podfile, add the following line to app's target:

pod 'Smartech-iOS-SDK' , '~> 3.1.1'
pod 'SmartechNudges', '~> 8.5.3'

For e.g. if you want to install Smartech-Nudges pod to "Gretel" target, your podfile will look like:

target 'Gretel' do
    pod 'Smartech-iOS-SDK' , '~> 3.1.1'
    pod 'SmartechNudges', '~> 8.5.3'
end
  1. Pod install

Open terminal, go to the project directory and run the following command:

pod install

This will install the SDK in your project. Once that is done, close the Xcode project and open <app_name>.xcworkspace in the project directory.

📘

Using .xcworkspace

Henceforth, .xcworkspace should be used to open this project in Xcode.

Step 3: Create Bridging Header for Swift

If you are using Swift, add the following import to your app bridging header file. If your project doesn't have a bridging header, follow this FAQs to create a bridging header:
[app_name]-bridging-header.h

#import <SmartechNudges/Hansel-umbrella.h>

Step 4: Updating Capabilities

In Xcode target, go to Signing & Capabilities, and click on "+Capability" as shown below, if you do not have any "Keychain Groups" setup. If you do, you can directly proceed to the next step.

Click on "+Capability" to get started

Add a new Keychain Group (as shown below) and enter hansel_public_key (Hansel uses KeyChain Sharing for decryption of Hansel SDK's responses)

Create a new Keychain Group with the value as shown

Step 5: Configure Apps Info.plist with Hansel Keys

You need to add a key named HanselKeys with type Dictionary. Init add the following keys and values with their types.

Key

Data type

Description

HanselAppId

String

Please get in touch with your account manager to create app on Hansel dashboard

HanselAppkey

String

Please get in touch with your account manager to create app on Hansel dashboard

Following is the source code snippet of apps Info.plist for key Hansel Keys:

<key>HanselKeys</key>
    <dict>
        <key>HanselAppId</key>
        <string>value of app id</string>
    <key>HanselAppKey</key>
        <string>value of app key</string>
    </dict>

Following is the image representation of apps Info.plist for key HanselKeys:

Step 6: Configuring Analytics

You need to link Hansel with your analytics provider to measure the impact of the changes you make on the dashboard. Track multiple variations of the user experience ( for e.g. variations of the target button with different colors, CTAs, fonts, size, placement etc.) on your analytics dashboard. Hansel sends all the related data to your analytics provider, without you having to add any extra line of code.

👍

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 7: 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.
#import <SmartechNudges/Hansel-umbrella.h>

//Setting User ID
[[Hansel getUser] setUserId:@"user_id"];

//Reset User ID and User attributes.
[[Hansel getUser] clear];
//Setting User ID
Hansel.getUser().setUserId("user_id")

//Reset User ID and User attributes.
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:

#import <SmartechNudges/Hansel-umbrella.h>
  
[[Hansel getUser] putDoubleAttribute:25 forKey:@"age"];
Hansel.getUser().putDoubleAttribute(25, forKey: "age")
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 8: Setting up Test Device

Once you have successfully integrated the SDK, ensure that you set up test devices. To learn more, click here .

Step 9: Firing events from test devices

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. To learn more on setting up test device, please click here .

Step 10: 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.

Updated 8 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.