Mobile SDKs Reference

Initialize the SDK

As a first you’ll need to install our SDK in your mobile app. You can find detailed installation methods directly in the Github code repositories.

Each repositories also include a sample application showing you how to load and initialize the client.

Right after loading the SDK, you’ll need to initialize the client by providing your Refiner environment ID. You can find the ID under “Settings > Mobile SDK” in the Refiner dashboard.

You can also activate a debug mode during development. When activated, all communication with our backend server is getting logged.

Mobile SDK methods

All Mobile SDKs provide the same set of methods which you can use to identify users, track user behaviour, or launch surveys ad-hoc.

Below we explain what each method does and how you can use it. Please consult the SKD specific documentation for the syntax and code examples.

identifyUser

Each user of your app needs to identified with a unique userId using the “Identify User” method.

Next to a unique user ID, you can also provide additional user traits. The provided user traits can be used to segment users in your Refiner account and create custom target audiences for your surveys. You can also use our API to provide the same user traits through a backend integration.

Refiner has a couple of reserved fields you should be aware of. These fields can’t be overwritten or have a certain behaviour attached to them.

If you are using our multi-language surveys feature, you can provide a “locale” string to show surveys in a specific language.

Lastly, you can provide a Identity Verification signature for increased level of security in a production environment.

When a user logs out from your app or changes user accounts, you can call the “Reset User” method.

attachToResponse

Next to providing user traits, it is also possible to attach contextual data to survey responses. The “Attach to Response” method lets you provide such data.

trackScreen

Whenever your user navigates to a specific screen in your app, you can use the “Track Screen” method to surface that information to Refiner.

Tracking screens will allow you to launch surveys in specific areas in your app. In the Refiner dashboard, you can create a set of screen rules for each survey which determines on which screens a survey should be launched.

You can choose screen names freely and you don’t need to systematically track each screen. We recommend to track screens on which you might want to show a survey one day.

trackEvent

You can track whenever a user performs an important key action in your app (log-in, purchase, …). User event tracking can be used to created User Segments and Target Audiences in Refiner.

ping

Depending on your setup, you might want to initiate regular checks for surveys that are scheduled for the current user. For example when you are using time based trigger events, when using our Follow-Up Mode, or when a target audience is based on user data received by our backend API.

The ping method provides an easy way to perform such checks. You can call the Ping method at key moments in a user’s journey, such as when the app is re-opened, or when the user performs a specific action.

showForm

Sometimes you might want to show a survey programmatically, directly from your application’s code, instead of relying on targeting rules defined in the Refiner dashboard. The mobile SDK exposes a “Show Form” method that allows you to do exactly this.

Please make sure that your survey is using the “Manual” trigger event in “Targeting” section of the survey editor.

setProject

This method allows you to dynamically change the Refiner environment of your app during runtime.

Callbacks

Registering callback functions allows you to execute code at specific moments in the lifecycle of a survey. Our SDK let you register the following callbacks:

MethodDescription
onBeforeShowGets called right before a survey is supposed to be shown.
onNavigationGets called for each step when the user responds to questions or navigates through the survey.
onShowGets called when a survey widget becomes visible to your user.
onCloseGets called when the survey widgets disappears from the screen.
onDismissGets called when the user dismissed a survey by clicking on the “x” in the top right corner.
onCompleteGets called when the user completed (submitted) the entire survey.

To register callbacks, please refer to the following platform specific documentation:

Was this helpful? Let us know with a quick a vote