You might want a user who opens a push message to receive an in-app message upon arriving in the app. This push-to-inapp sequence is possible with Localytics. To execute this, follow the steps below:
-
Set up the push campaign along with selecting your audience and scheduling criteria. Once this has been completed, do not activate the campaign yet, then click on Return to Message. It will be saved as a draft.
-
Create an in-app campaign. The in-app campaign Audience should be set to Everyone. You will set the display trigger such that the message will only display to users that open a particular push notification.
-
On the Scheduling page of the in-app campaign, the in-app trigger should be set to the Event called Localytics Push Opened. Then add a filter and select the Campaign Name attribute. You should then select the name of the Push Campaign, if available. If the push campaign has not yet gone live, you won't see this as an option but fortunately, there is an easy workaround. You will need to manually enter the campaign ID for the push campaign (not the campaign name). To find the campaign ID, navigate to the push campaign of interest, look at the URL and note the numeric identifier. Type this campaign ID into the Campaign Name field. For example, in
https://dashboard.localytics.com/interact?org_id=152#/campaign/amp/18115?days=31&offset=446
, the campaign ID is18115
. (Note: The reason why you paste Campaign ID rather than Campaign Name is that for convenience, we let users select Campaign Name then do a lookup in the background for Campaign ID). Please note to only enter the numbers for the campaign ID and no other characters like "#" as entering any other characters in the text field can cause the campaign to not run properly. -
First, go live with the in-app campaign. It can be beneficial to go live with the in-app campaign well in advance of the push campaign so that the in-app creative has the chance to silently transmit to end-users' devices to be rendered later, once the triggering event occurs. The reason for this is because the end-user needs to have a session first so that the creative can download onto the device. If you don't provide lead time, the creative will need to both transmit to the device and render almost simultaneously, so if the creative is large or end-users' connections are slow, the message may not have the chance to render immediately.
-
If you are using Android SDK 4.2 or lower, you will need to do a one time setup of adding a bit of code to ensure the display of the in-app. In all Localytics integrated
Activity
classes include the following in theonResume()
method (if this activity uses manual session management, ensure that this code is included afterLocalytics.setInAppMessageDisplayActivity(this)
:
Bundle extras = getIntent().getExtras();
if (extras != null) {
String campaignId = extras.get("Localytics-Push-Campaign-ID-Key");
if (campaignId != null) {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("Campaign ID", campaignId);
Localytics.triggerInAppMessage("Localytics Push Opened", attributes)
extras.remove("Localytics-Push-Campaign-ID-Key");
}
}
6. Finally, make sure to go live with the push campaign and that's it. Only users that open the push message will receive the in-app message.