Integration
Connect the app's milesยฎ SDK to all of your app's features to start driving your users and build retention.
Last updated
Connect the app's milesยฎ SDK to all of your app's features to start driving your users and build retention.
Last updated
React Native Integration
You have the app's miles banner up and running.
Now you need to integrate the SDK deeper into your application so that your user can: - understand how the program works. - discover all the functionalities that you slaved away at developing ! - be rewarded for consistently using your application's main features.
Skip to the Connect section if you intend to have everyone participate in the program by default
The first thing that the user will see when clicking on the app's miles banner is the onboarding.
This onboarding has two purposes:
There are up to 3 buttons on the onboarding, and you must attach a listener in order to redirect the user depending on their input.
The input of the user will affect the variable OPT_IN
in the following way:
(default: APM_DEVICE_OPT_IN_NOT_SET)
There can be two different onboardings:
for non-connected users
for connected users
Both of these onboardings only appear if the user has not decided whether they want to opt in or not.
An onboarding only appears if the optIn value is NOT_SET
.
If you want to force the optIn and still wish to present the program, it is better to use tutorials or walkthroughs (both can be configured in our BackOffice and require no code).
In order to offer a seamless experience, app's miles doesn't have a login or create-account page. The login/create-account process for app's miles is parallel to yours.
This method can both connect and create an account:
If an app's miles account already exists with the given userID, the method signs them in.
If no account exists, the method will automatically create their account and sign them in.
This method needs : ยซ email ยป, ยซ userID ยป and ยซ optIn ยป โ ยซ email ยป is the email of user โ ยซ userID ยป is a unique identifier in your database โ ยซ optIn ยป is the RGPD OptIn
If you donโt want give the email, you can build a encrypted email with the userID: {userID}@{your-company-name}.com
(e.g. 123456789@appsmiles.fr)
The same way the login process is parallel to yours, so is the logout:
In order to reward the user for an action, you need to place triggers in your application. You will need to follow the Tagging plan that your marketing team created with us.
Be careful with the spelling, an extra character like a 's' will change the tag
Call the method triggerAction to send a tag
Make sure to test each action by looking at the logs, especially for actions that are complex
If your tagging plan requires the use of filters, you may need to send properties with your action.
Call triggerAction with a second parameter to send a tag with properties
โ property.key
: Property keys must be strings and must be in the tagging plan (e.g. ยซ zipcode ยป, ยซ establishment ยป).
โ property.value
: Property values must be strings. (e.g. ยซ 33000 ยป, ยซ restaurant ยป).
This example tag will match with the action ยซ Write a review on a restaurant in Bordeaux ยป.
A tag may have multiple versions configured in our BackOffice. This is an unlikely scenario, but as an example, sending the same tag and properties 3 times may match with a different version each time.
In the same idea than 2. Send an action with properties, if your tagging plan requires the use of filters, you may need to send us userProperties so that we can offer filtered actions to the user.
Use the class APMUserPropertiesUtils to manage user properties.
userProperty.key
: Property keys must strings. (e.g. ยซ zipcode ยป, ยซ membership_level ยป).
userProperty.value
:Property values must strings. (e.g. ยซ 33000 ยป, ยซ premium ยป).
Example:
Adding a userProperty with a key that already exists will update it.
If a userProperty is no longer valid, you can remove it (example: user does not wish to be geolocated anymore),
Example:
If you have changed a userProperty that may have an impact on the actions that we can propose to the user, you will want to refresh the SDK (i.e. tell it to communicate with our API to get updated info).
You can do this by calling:
We showcase one action above others (Challenge of the day). Each action can be configured in our BackOffice with a deeplink so that the user can go to the screen where they can perform the action.
You can hide the badge if you have a screen where you don't want the user to be distracted (e.g. checkout).
Make sure to show the badge again once you leave the screen !
Logs are quire useful, right ? Here's how to unleash the (controlled) fury of debug logs:
You can be notify when the user changed with the following code
Tags can be set on levels, actions, challenges and trophies. When the user reaches/completes/obtains one of the above, they will acquire the corresponding tags. You can retrieve all the tags a user has acquired:
Present and explain the program
Ask the user their consent to take part in the program
OK: APM_DEVICE_OPT_IN_ACCEPT
Later: APM_DEVICE_OPT_IN_NOT_SET
Never: APM_DEVICE_OPT_IN_REFUSE
To listen to the click on the "Let's go !" button and get the deeplink URI, you need to use APMDeepLinkActionUtilsModule.