diff --git a/TOC.md b/TOC.md new file mode 100644 index 0000000..894f30b --- /dev/null +++ b/TOC.md @@ -0,0 +1,15 @@ +--- +user-guide-title: Implement and Use Adobe Target with Adobe Mobile Services SDK v4 for Android +user-guide-url: /content/help/en/target-learn/mobile-sdk-v4-android/overview.html +audience: end-user +--- + +# Implement and Use Adobe Target with Adobe Mobile Services SDK v4 for Android {#mobile-sdk-v4-android} + ++ [Overview](overview.md) ++ [Download and Update the Sample App](download-and-update-the-sample-app.md) ++ [Add Requests](add-requests.md) ++ [Add Parameters](add-parameters.md) ++ [Create Audiences and Offers](create-audiences-and-offers.md) ++ [Personalize Layouts](personalize-layouts.md) ++ [Feature Flagging](feature-flagging.md) diff --git a/add-parameters.md b/add-parameters.md new file mode 100644 index 0000000..af58589 --- /dev/null +++ b/add-parameters.md @@ -0,0 +1,146 @@ +--- +title: Add Parameters to the Requests +seo-title: Add Parameters to the Requests +description: In this lesson we will validate Adobe lifecycle metrics and add custom parameters to the prefetch request. The lifecycle metrics and custom parameters will be used for creating audiences that determine new and returning users. We will also enhance the third location request (found on the thank you screen) with parameters that will be used to determine the user's trip origin & destination so we can later serve an offer based on those parameters. +seo-description: In this lesson we will validate Adobe lifecycle metrics and add custom parameters to the prefetch request. The lifecycle metrics and custom parameters will be used for creating audiences that determine new and returning users. We will also enhance the third location request (found on the thank you screen) with parameters that will be used to determine the user's trip origin & destination so we can later serve an offer based on those parameters. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Add Parameters to the Requests + +In this lesson we will validate Adobe lifecycle metrics and add custom parameters to the prefetch request. The lifecycle metrics and custom parameters will be used for creating audiences that determine new and returning users. We will also enhance the third location request (found on the thank you screen) with parameters that will be used to determine the user's trip origin & destination so we can later serve an offer based on those parameters. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Add and Validate the Adobe Lifecycle Metrics Request (used for creating audiences later)** +* **Add Parameters to the Prefetch Request (used for creating audiences later)** +* **Add Parameters to the Live Location (used for creating audiences later)** +* **Validate the Parameters for Both Requests** + +## Add the Lifecycle Parameters + +The Config.collectLifecycleData request found in the onResume() function enables the [Adobe mobile lifecycle metrics](https://docs.adobe.com/content/help/en/mobile-services/android/metrics.html). This request adds parameters to location requests, including the prefetch request. We'll build our audience segments in the next lesson using data that the lifecycle request provides. + +To enable lifecycle metrics & parameters, make sure the Config.collectLifecycleData is added to the onResume() function in your HomeActivity: +![Lifecycle Request](assets/lifecycle_code.jpg) + +Here is the updated code: + +```java +@Override +protected void onResume() { + super.onResume(); + Config.collectLifecycleData(this); + targetPrefetchContent(); +} +``` + +### Validate the Lifecycle Parameters for the Prefetch Request + +Run the Emulator and use Logcat to validate the lifecycle parameters. Filter for "prefetch" to find the prefetch response and look for the new parameters: +![Lifecycle Validation](assets/lifecycle_validation.jpg) + +## Add the at_property Parameter to the Prefetch Request + +Adobe Target Properties are defined in the Target interface and are used to establish boundaries for personalizing apps and websites. The at_property parameter identifies the specific property where your offers & activities are accessed & maintained. We'll add this property to the prefetch and live location requests. + +You can retrieve your at_property value in the Target interface under Setup > Properties. Hover over the property, select the code snippet icon and copy the at_property value: +![Copy at_property](assets/at_property_interface.jpg) + +Add it as a parameter for each location in the prefetch request like this: +![Add at_property parameter](assets/params_at_property.jpg) +Here is the updated code for the targetPrefetchContent() function: + +```java +public void targetPrefetchContent() { + List prefetchList = new ArrayList<>(); + + Map params1; + params1 = new HashMap(); + params1.put("at_property", "your at_property value goes here"); + + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_home, params1)); + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_search, params1)); + Target.TargetCallback prefetchStatusCallback = new Target.TargetCallback() { + @Override + public void call(final Boolean status) { + HomeActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + String cachingStatus = status ? "YES" : "NO"; + System.out.println("Received Response from prefetch : " + cachingStatus); + engageMessage(); + setUp(); + + } + }); + }}; + Target.prefetchContent(prefetchList, null, prefetchStatusCallback); + } +``` + +## Validate the at_property Parameter in the Prefetch Request + +Now run the emulator and use Logcat to verify that the at_property is showing on the prefetch request & response for both locations: +![Validate the at_property parameter](assets/parameters_at_property_validation.jpg) + +## Add Custom Parameters to the Live Location Request + +The third location (wetravel_context_dest) was already loaded in real-time and validated in the previous lesson, so it's ready to display an offer. This location will display a relevant banner offer on the final confirmation screen when a user books a trip. Before we move on to build the offer, we need the at_property and two custom location parameters for this request to identify the trip source and destination. In the next lesson, we'll use these parameter values to build personalized offers. Add the following parameters to the targetLoadRequest() function in the ThankYouActivity controller: +![Add Parameters to the Live Location Request](assets/parameters_live_location.jpg) +Here is the updated code for the targetLoadRequest() function: + +```java +public void targetLoadRequest(final ArrayList recommandations) { + Map locationParams = new HashMap<>(); + locationParams.put("at_property","add your at_property value here"); + locationParams.put("locationSrc", (""+Utility.getInSharedPreference(ThankYouActivity.this,Constant.departure,""))); + locationParams.put("locationDest", (""+Utility.getInSharedPreference(ThankYouActivity.this,Constant.destination,""))); + + Target.loadRequest(Constant.wetravel_context_dest, "", null, null, locationParams, new Target.TargetCallback() { + @Override + public void call(final String response) { + try { + runOnUiThread(new Runnable() { + @Override + public void run() { + AppDialogs.dialogLoaderHide(); + filterRecommendationBasedOnOffer(recommandations, response); + recommandationbAdapter.notifyDataSetChanged(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + Target.clearPrefetchCache(); +} +``` + +### Validate the Custom Parameters in the Live Location Request + +Run the emulator and open Logcat. Filter for one of the parameters to verify that the request contains the needed parameters: +![Validate the Custom Parameters in the Live Location Request](assets/parameters_live_location_validation.jpg) + +## Using Additional Parameters + +Although not used in this demo project, order details will need to be tracked in a live app so Target can use order details as metrics/dimensions. This can be done by using order parameters. Also, for future projects, you may wish to use additional profile parameters and location parameters. Adobe Target Methods and parameters for Android are explained more here: [Android SDK 4.x Target Methods](https://marketing-beta.adobe.com/resources/help/mobile/android/c_target_methods.html). + +## About Analytics for Target (A4T) + +Adobe Analytics can be configured as the reporting source for Target. This allows all metrics/dimensions collected by the Target SDK to be viewed in Adobe Analytics. See the [A4T Overview](https://docs.adobe.com/content/help/en/target/using/integrate/a4t/a4t.html) for more details. + +## Conclusion + +Nice work! Now that parameters are in place, we're ready to use those parameters to create audiences and offers in Adobe Target. + + +**[NEXT : "Create Audiences and Offers" >](create-segments-and-offers.md)** + \ No newline at end of file diff --git a/add-requests.md b/add-requests.md new file mode 100644 index 0000000..dc6e625 --- /dev/null +++ b/add-requests.md @@ -0,0 +1,307 @@ +--- +title: Add Adobe Target Requests +seo-title: Add Adobe Target Requests +description: The Adobe Mobile Services SDK (v4) provides Adobe Target methods & functionality that enable you to personalize your app with different experiences for different users. +seo-description: The Adobe Mobile Services SDK (v4) provides Adobe Target methods & functionality that enable you to personalize your app with different experiences for different users. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Add Adobe Target Requests + +The Adobe Mobile Services SDK (v4) provides Adobe Target methods & functionality that enable you to personalize your app with different experiences for different users. + +In this lesson, you will prepare the We.Travel app for personalization by implementing multiple Target requests. + +## Prerequisites + +Be sure to [download and update the We.Travel app](download-and-update-the-sample-app.md). + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Cache Multiple Target Locations Using a Batch Prefetch Request** +* **Load Prefetched Target Locations** +* **Load a Target Location in Real-Time (non-prefetched)** +* **Clear Prefetched Locations from Cache** +* **Validate Prefetched Locations & a Live Location in Android Studio** + +## Terminology + +Below is some of key Target terminology that we will be using in this tutorial. + +* **Request:** a network request to the Adobe Target servers +* **Location:** a placeholder for Target offers +* **Offer:** a snippet of code, defined in the Target user interface (or with API), which is delivered in the response. Usually JSON when Target is used in native mobile apps. +* **Batch Request:** a single request that includes multiple locations +* **Prefetch Request:** a single request that retrieves offers and caches them into memory for future use in the app +* **Batch Prefetch Request:** a single request that prefetches offers for multiple locations +* **Audience:** a group of visitors defined in the Target interface or shared to Target from other Adobe applications (e.g. “iPhone X visitors”, “visitors in the California”, “First App Open” +* **Activity:** a Target construct, defined in the Target user interface (or with API) which links locations, offers and Audiences to create a personalized experience. + +## Add a Batch Prefetch Request + +Our first scenario on We.Travel is a batch prefetch request with two Target locations to the Home Screen. In a later lesson, we'll configure offers for these locations that display messages to help guide new users through the booking process. For now, we'll use the locations as placeholders for the offers. + +A prefetch request fetches Target locations as minimally as possible by caching Adobe Target server responses. A batch prefetch request retrieves and caches multiple locations. All prefetched locations are cached on the device for future use in the user session. By prefetching multiple locations on the Home Screen, we can retrieve offers for later use as the user navigates through the app. Refer to the [prefetch documentation](https://docs.adobe.com/content/help/en/mobile-services/android/target-android/c-mob-target-prefetch-android.html) for more details on prefetch methods. + +### Add Constants + +First, we'll add constants that will be used for this project. Open the Constant.java file found under app > src > main > java > com.wetravel > Utils. Add these four constants: + +![Add Constants](assets/constants.jpg) + +Here is the code: + +```java +public static final String wetravel_engage_home = "wetravel_engage_home"; +public static final String wetravel_engage_search = "wetravel_engage_search"; +public static final String wetravel_context_dest = "wetravel_context_dest"; +public static final String destination = "destination"; +public static final String departure = "departure"; +public static final String wetravel_feature_flag_recs = "wetravel_feature_flag_recs"; +``` + +### Add Prefetch Request + +Next we'll update the HomeActivity controller (the Home Screen's source code), which is located under app > main > java > com.wetravel > Controller. We'll add the two code blocks shown in red: + +![HomeActivity Prefetch Code](assets/homeactivity.jpg) + +Scroll down to the end of the HomeActivity's code and add the code provided below after the setHeader() function: + +```java +@Override +protected void onResume() { + super.onResume(); + targetPrefetchContent(); +} + +public void targetPrefetchContent() { + List prefetchList = new ArrayList<>(); + + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_home, null)); + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_search, null)); + + Target.TargetCallback prefetchStatusCallback = new Target.TargetCallback() { + @Override + public void call(final Boolean status) { + HomeActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + String cachingStatus = status ? "YES" : "NO"; + System.out.println("Received Response from prefetch : " + cachingStatus); + setUp(); + + } + }); + }}; + Target.prefetchContent(prefetchList, null, prefetchStatusCallback); +} +``` + +### Batch Prefetch Request Code Explanation + +| Code | Description | +|--- |--- | +| targetPrefetchContent() | Retrieves and caches two Target locations. The first time a request is sent, the Target Server will create a location name which we will use later in the Target interface. | +| Constant.wetravel\_engage\_home | Prefetched Target location which will later be loaded & display its offer content on the Home Screen | +| Constant.wetravel\_engage\_search | Prefetched Target location which will later be loaded & display its offer content on the Search Results Screen. Since this is a second location in the prefetch, this prefetch request is called a "prefetch batch request". | +| setUp() | Renders the app's home screen after the Target offers are prefetched | + +### About Asynchronous vs. Synchronous + +In this scenario, the prefetch request runs synchronously as a blocking call, just before the app's home screen renders. Note how setUp() is called after the prefetch request. This can be beneficial in many scenarios because it ensures that Target offers are available before the app's screen renders. To allow the requests load asynchronously (in the background), just call setUp() within the onCreate() function instead. + +### Validate the Batch Prefetch Request + +Open the Android Emulator in Android Studio. The following examples use the Pixel 2 on Android Q (version 9+, API level 29). The prefetch response should read "prefetch response received": + +When the Home screen renders, the prefetch request should be loaded. With Logcat, filter for "Target" to see the request & response: + +![Validate the requests on the Home Screen](assets/prefetch_validation.jpg) + +If you are not seeing a successful response, verify settings in the ADBMobileConfig.json file and code syntax in the HomeActivity file. + +Two locations are now cached to the device. The location names are also created on the Target server which will make them visible in the Target interface. + +### Add Load Requests for Each Cached Location + +Now that the locations are prefetched and cached to the device, let's add load requests so these locations can be displayed on the screen later. We'll add a new custom method called engageMessage() that will run with the prefetch request. engageMessage() will call Target.loadRequest() which is the load request. engageMessage() runs before setUp() to ensure that the load request is called before the screen is set up. + +First, add the engageMessage() call & method for the wetravel_engage_home location in the HomeActivity: + +![Add first load request](assets/wetravel_engage_home_loadRequest.jpg) + +Here is the updated code: + +```java + public void targetPrefetchContent() { + List prefetchList = new ArrayList<>(); + + Map params1; + params1 = new HashMap(); + params1.put("at_property", "your at_property value goes here"); + + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_home, params1)); + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_search, params1)); + + Target.TargetCallback prefetchStatusCallback = new Target.TargetCallback() { + @Override + public void call(final Boolean status) { + HomeActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + String cachingStatus = status ? "YES" : "NO"; + System.out.println("Received Response from prefetch : " + cachingStatus); + engageMessage(); + setUp(); + + } + }); + }}; + Target.prefetchContent(prefetchList, null, prefetchStatusCallback); + } + + public void engageMessage() { + Target.loadRequest(Constant.wetravel_engage_home, "", null, null, null, + new Target.TargetCallback(){ + @Override + public void call(final String s) { + runOnUiThread(new Runnable() { + @Override + public void run() { + System.out.println("Engage Message : " + s); + if(s != null && !s.isEmpty()) Utility.showToast(getApplicationContext(), s); + } + }); + } + }); + } +``` + +Now add the engageMessage() call & method for the wetravel_engage_search location in the SearchBusActivity. Notice that the engageMessage() call is set in the onResume() method before the call to setUpSearch() so it runs before the screen is set up: + +![Add second load request](assets/wetravel_engage_search_loadRequest.jpg) + +Here is the updated code: + +```java + @Override + public void onResume() { + super.onResume(); + engageMessage(); + setUpSearch(); + } + + public void engageMessage() { + Target.loadRequest(Constant.wetravel_engage_search, "", null, null, null, + new Target.TargetCallback(){ + @Override + public void call(final String s) { + runOnUiThread(new Runnable() { + @Override + public void run() { + System.out.println("Engage Message : " + s); + if(s != null && !s.isEmpty()) Utility.showToast(getApplicationContext(), s); + } + }); + } + }); + } +``` + +## Add a Real-time Request + +Our next scenario is to load a live location placeholder on the Thank You screen. The request that we add here will serve an offer that depends on the user's trip destination, so this will need to be a real-time location. Target needs to determine the right offer at the time of the booking. A prefetched cached offer won't work here, since we wouldn't know the user's destination before they had selected it. + +Now let's add a real-time location placeholder on the Thank You screen. In the ThankYouActivity file, we'll modify and add the code shown in red. Comment out the lines shown. We'll be using that code to display offers later on. + +![Add a Real-time location on the Thank You Screen](assets/thankyou.jpg) + +Add the targetLoadRequest method at the end of the file: + +![Add a Real-time location on the Thank You Screen 2](assets/thankyou2.jpg) + +Here are the code snippets:: + +```java +// Comment out these lines in the getRecommendations() method & add the targLoadRequest request: +public void getRecommandations(){ + GetJSON getJSON = new GetJSON(this,Constant.json_recommandation) { + @Override + public void response(String response) { + try { + Gson gson = new Gson(); + Recommandation recommandation = gson.fromJson(response,Recommandation.class); + // AppDialogs.dialogLoaderHide(); + // recommandations.addAll(recommandation.recommandations); + // recommandationbAdapter.notifyDataSetChanged(); + targetLoadRequest(recommandation.recommandations); + }catch (Exception e){ + e.printStackTrace(); + } + } + }; + getJSON.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); +} + +// Add this code block after the filterRecommendationBasedOnOffer() method: +public void targetLoadRequest(final ArrayList recommandations) { + + Target.loadRequest(Constant.wetravel_context_dest, "", null, null, null, new Target.TargetCallback() { + @Override + public void call(final String response) { + try { + runOnUiThread(new Runnable() { + @Override + public void run() { + AppDialogs.dialogLoaderHide(); + filterRecommendationBasedOnOffer(recommandations, response); + recommandationbAdapter.notifyDataSetChanged(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); +} +``` + +### targetLoadRequest() Code Explanation + +| Code | Description | +|--- |--- | +| targetLoadRequest() | This function fires Target.loadRequest() which loads & displays the wetravel\_context\_dest location | +| Constant.wetravel\_context\_dest | This is the location that will display offers to the user (we'll configure the offer content in a later lesson) | + +### Validate the Real-time Request + +Open the Android Emulator and go through all the steps to book a trip: Home > Bus Search Results > Seat Selection, Payment Options (any payment option with blank data will work). + +On the final Thank You screen, watch Logcat for the response. The response should read "Default content was returned for "wetravel\_context\_dest": + +![Add a Real-Time location on the Thank You Screen](assets/thankyou_validation.jpg) + +## Clearing Prefetched Locations from Cache + +There may be situations where prefetched locations need to be cleared during a session. For example, when a booking occurs, it makes sense to clear the cached locations since the user is now "engaged" and understands the booking process. If they book another trip during their session, they won't need the original locations on the home screen & search results screen to guide their booking. It would make more sense to clear the locations from cache and prefetch new locations for perhaps a discounted second booking or another relevant scenario. Logic could be added to the home screen & search results screen to prefetch new locations if a booking has taken place during the session. + +For this example, we'll just clear prefetched locations for the session when a booking takes place. This is done by calling the Target.clearPrefetchCache() function. Set the function inside the targetLoadRequest() function as shown below: + +![Clear Prefetched Locations from Cache](assets/clearPrefetch.jpg) + +Here is the code: + +```java +Target.clearPrefetchCache(); +``` + +Congratulations! Your app now has the framework for personalization. In the next lesson, you'll be adding parameters to these locations. This will enhance the locations and provide more data-driven insights to optimize the app. + +**[NEXT : "Add Parameters" >](add-parameters.md)** diff --git a/assets/2mboxes.jpg b/assets/2mboxes.jpg new file mode 100644 index 0000000..76df963 Binary files /dev/null and b/assets/2mboxes.jpg differ diff --git a/assets/5Steps.jpg b/assets/5Steps.jpg new file mode 100644 index 0000000..dae07d6 Binary files /dev/null and b/assets/5Steps.jpg differ diff --git a/assets/DB6AFD89-1066-4A8B-9F0A-70DE1DAF571A.jpg b/assets/DB6AFD89-1066-4A8B-9F0A-70DE1DAF571A.jpg new file mode 100644 index 0000000..e45c1d2 Binary files /dev/null and b/assets/DB6AFD89-1066-4A8B-9F0A-70DE1DAF571A.jpg differ diff --git a/assets/activity_contextual_a_final.jpg b/assets/activity_contextual_a_final.jpg new file mode 100644 index 0000000..8ebb37f Binary files /dev/null and b/assets/activity_contextual_a_final.jpg differ diff --git a/assets/activity_contextual_b_final.jpg b/assets/activity_contextual_b_final.jpg new file mode 100644 index 0000000..b3e259f Binary files /dev/null and b/assets/activity_contextual_b_final.jpg differ diff --git a/assets/activity_create.jpg b/assets/activity_create.jpg new file mode 100644 index 0000000..2f44a1a Binary files /dev/null and b/assets/activity_create.jpg differ diff --git a/assets/activity_create_1.jpg b/assets/activity_create_1.jpg new file mode 100644 index 0000000..62a3cd7 Binary files /dev/null and b/assets/activity_create_1.jpg differ diff --git a/assets/activity_create_10.jpg b/assets/activity_create_10.jpg new file mode 100644 index 0000000..b825927 Binary files /dev/null and b/assets/activity_create_10.jpg differ diff --git a/assets/activity_create_11.jpg b/assets/activity_create_11.jpg new file mode 100644 index 0000000..2a992ae Binary files /dev/null and b/assets/activity_create_11.jpg differ diff --git a/assets/activity_create_12.jpg b/assets/activity_create_12.jpg new file mode 100644 index 0000000..e7187a4 Binary files /dev/null and b/assets/activity_create_12.jpg differ diff --git a/assets/activity_create_13.jpg b/assets/activity_create_13.jpg new file mode 100644 index 0000000..be6052a Binary files /dev/null and b/assets/activity_create_13.jpg differ diff --git a/assets/activity_create_14.jpg b/assets/activity_create_14.jpg new file mode 100644 index 0000000..468d119 Binary files /dev/null and b/assets/activity_create_14.jpg differ diff --git a/assets/activity_create_2.jpg b/assets/activity_create_2.jpg new file mode 100644 index 0000000..07244f1 Binary files /dev/null and b/assets/activity_create_2.jpg differ diff --git a/assets/activity_create_3.jpg b/assets/activity_create_3.jpg new file mode 100644 index 0000000..21ce360 Binary files /dev/null and b/assets/activity_create_3.jpg differ diff --git a/assets/activity_create_4.jpg b/assets/activity_create_4.jpg new file mode 100644 index 0000000..9556d72 Binary files /dev/null and b/assets/activity_create_4.jpg differ diff --git a/assets/activity_create_5.jpg b/assets/activity_create_5.jpg new file mode 100644 index 0000000..366adaa Binary files /dev/null and b/assets/activity_create_5.jpg differ diff --git a/assets/activity_create_6.jpg b/assets/activity_create_6.jpg new file mode 100644 index 0000000..1d5bf1a Binary files /dev/null and b/assets/activity_create_6.jpg differ diff --git a/assets/activity_create_7.jpg b/assets/activity_create_7.jpg new file mode 100644 index 0000000..50cbd93 Binary files /dev/null and b/assets/activity_create_7.jpg differ diff --git a/assets/activity_create_8.jpg b/assets/activity_create_8.jpg new file mode 100644 index 0000000..46b40d7 Binary files /dev/null and b/assets/activity_create_8.jpg differ diff --git a/assets/activity_create_9.jpg b/assets/activity_create_9.jpg new file mode 100644 index 0000000..387c926 Binary files /dev/null and b/assets/activity_create_9.jpg differ diff --git a/assets/activity_engage_users.jpg b/assets/activity_engage_users.jpg new file mode 100644 index 0000000..1a4d8a3 Binary files /dev/null and b/assets/activity_engage_users.jpg differ diff --git a/assets/activity_engage_users_a.jpg b/assets/activity_engage_users_a.jpg new file mode 100644 index 0000000..f141482 Binary files /dev/null and b/assets/activity_engage_users_a.jpg differ diff --git a/assets/activity_engage_users_a_audience.jpg b/assets/activity_engage_users_a_audience.jpg new file mode 100644 index 0000000..ed1f0c8 Binary files /dev/null and b/assets/activity_engage_users_a_audience.jpg differ diff --git a/assets/activity_engage_users_a_final.jpg b/assets/activity_engage_users_a_final.jpg new file mode 100644 index 0000000..bde19f1 Binary files /dev/null and b/assets/activity_engage_users_a_final.jpg differ diff --git a/assets/activity_engage_users_a_html_offer.jpg b/assets/activity_engage_users_a_html_offer.jpg new file mode 100644 index 0000000..cb23146 Binary files /dev/null and b/assets/activity_engage_users_a_html_offer.jpg differ diff --git a/assets/activity_engage_users_a_html_offer2.jpg b/assets/activity_engage_users_a_html_offer2.jpg new file mode 100644 index 0000000..26bd31a Binary files /dev/null and b/assets/activity_engage_users_a_html_offer2.jpg differ diff --git a/assets/activity_engage_users_a_offer.jpg b/assets/activity_engage_users_a_offer.jpg new file mode 100644 index 0000000..2947565 Binary files /dev/null and b/assets/activity_engage_users_a_offer.jpg differ diff --git a/assets/activity_engage_users_a_offer2.jpg b/assets/activity_engage_users_a_offer2.jpg new file mode 100644 index 0000000..e0a7dd4 Binary files /dev/null and b/assets/activity_engage_users_a_offer2.jpg differ diff --git a/assets/activity_engage_users_b_final.jpg b/assets/activity_engage_users_b_final.jpg new file mode 100644 index 0000000..567833c Binary files /dev/null and b/assets/activity_engage_users_b_final.jpg differ diff --git a/assets/activity_engage_users_goals.jpg b/assets/activity_engage_users_goals.jpg new file mode 100644 index 0000000..0a709f0 Binary files /dev/null and b/assets/activity_engage_users_goals.jpg differ diff --git a/assets/activity_engage_users_targeting.jpg b/assets/activity_engage_users_targeting.jpg new file mode 100644 index 0000000..02a4b0d Binary files /dev/null and b/assets/activity_engage_users_targeting.jpg differ diff --git a/assets/at_property_interface.jpg b/assets/at_property_interface.jpg new file mode 100644 index 0000000..1eff102 Binary files /dev/null and b/assets/at_property_interface.jpg differ diff --git a/assets/audience_locationDest_los_angeles.jpg b/assets/audience_locationDest_los_angeles.jpg new file mode 100644 index 0000000..0e8f4c4 Binary files /dev/null and b/assets/audience_locationDest_los_angeles.jpg differ diff --git a/assets/audience_locationDest_san_diego.jpg b/assets/audience_locationDest_san_diego.jpg new file mode 100644 index 0000000..e45c1d2 Binary files /dev/null and b/assets/audience_locationDest_san_diego.jpg differ diff --git a/assets/audience_new_app_users.jpg b/assets/audience_new_app_users.jpg new file mode 100644 index 0000000..7626722 Binary files /dev/null and b/assets/audience_new_app_users.jpg differ diff --git a/assets/audience_new_mobile_app_users.jpg b/assets/audience_new_mobile_app_users.jpg new file mode 100644 index 0000000..308e51c Binary files /dev/null and b/assets/audience_new_mobile_app_users.jpg differ diff --git a/assets/audience_new_mobile_app_users_1.jpg b/assets/audience_new_mobile_app_users_1.jpg new file mode 100644 index 0000000..7dd1f95 Binary files /dev/null and b/assets/audience_new_mobile_app_users_1.jpg differ diff --git a/assets/audience_new_mobile_app_users_2.jpg b/assets/audience_new_mobile_app_users_2.jpg new file mode 100644 index 0000000..ae98f4a Binary files /dev/null and b/assets/audience_new_mobile_app_users_2.jpg differ diff --git a/assets/audience_new_mobile_app_users_3.jpg b/assets/audience_new_mobile_app_users_3.jpg new file mode 100644 index 0000000..720b292 Binary files /dev/null and b/assets/audience_new_mobile_app_users_3.jpg differ diff --git a/assets/audience_returning_mobile_app_users.jpg b/assets/audience_returning_mobile_app_users.jpg new file mode 100644 index 0000000..f0febc2 Binary files /dev/null and b/assets/audience_returning_mobile_app_users.jpg differ diff --git a/assets/clearPrefetch.jpg b/assets/clearPrefetch.jpg new file mode 100644 index 0000000..0fdb40a Binary files /dev/null and b/assets/clearPrefetch.jpg differ diff --git a/assets/client_code.jpg b/assets/client_code.jpg new file mode 100644 index 0000000..86c6024 Binary files /dev/null and b/assets/client_code.jpg differ diff --git a/assets/config_file.jpg b/assets/config_file.jpg new file mode 100644 index 0000000..343715c Binary files /dev/null and b/assets/config_file.jpg differ diff --git a/assets/constants.jpg b/assets/constants.jpg new file mode 100644 index 0000000..2366346 Binary files /dev/null and b/assets/constants.jpg differ diff --git a/assets/create_activity.jpg b/assets/create_activity.jpg new file mode 100644 index 0000000..08da08e Binary files /dev/null and b/assets/create_activity.jpg differ diff --git a/assets/create_offers.jpg b/assets/create_offers.jpg new file mode 100644 index 0000000..550d062 Binary files /dev/null and b/assets/create_offers.jpg differ diff --git a/assets/engage_new_user_toast.jpg b/assets/engage_new_user_toast.jpg new file mode 100644 index 0000000..73991ef Binary files /dev/null and b/assets/engage_new_user_toast.jpg differ diff --git a/assets/engage_users_a.jpg b/assets/engage_users_a.jpg new file mode 100644 index 0000000..749b640 Binary files /dev/null and b/assets/engage_users_a.jpg differ diff --git a/assets/engage_users_activity.jpg b/assets/engage_users_activity.jpg new file mode 100644 index 0000000..cb8f720 Binary files /dev/null and b/assets/engage_users_activity.jpg differ diff --git a/assets/engage_users_b.jpg b/assets/engage_users_b.jpg new file mode 100644 index 0000000..b1c3562 Binary files /dev/null and b/assets/engage_users_b.jpg differ diff --git a/assets/error1.jpg b/assets/error1.jpg new file mode 100644 index 0000000..16c2813 Binary files /dev/null and b/assets/error1.jpg differ diff --git a/assets/feature_flag_activity.jpg b/assets/feature_flag_activity.jpg new file mode 100644 index 0000000..601a599 Binary files /dev/null and b/assets/feature_flag_activity.jpg differ diff --git a/assets/feature_flag_activity_2.jpg b/assets/feature_flag_activity_2.jpg new file mode 100644 index 0000000..afd00ab Binary files /dev/null and b/assets/feature_flag_activity_2.jpg differ diff --git a/assets/feature_flag_activity_3.jpg b/assets/feature_flag_activity_3.jpg new file mode 100644 index 0000000..c4f61d4 Binary files /dev/null and b/assets/feature_flag_activity_3.jpg differ diff --git a/assets/feature_flag_activity_4.jpg b/assets/feature_flag_activity_4.jpg new file mode 100644 index 0000000..97d246e Binary files /dev/null and b/assets/feature_flag_activity_4.jpg differ diff --git a/assets/feature_flag_activity_goals.jpg b/assets/feature_flag_activity_goals.jpg new file mode 100644 index 0000000..6aa026f Binary files /dev/null and b/assets/feature_flag_activity_goals.jpg differ diff --git a/assets/feature_flag_activity_targeting.jpg b/assets/feature_flag_activity_targeting.jpg new file mode 100644 index 0000000..dd7e71e Binary files /dev/null and b/assets/feature_flag_activity_targeting.jpg differ diff --git a/assets/feature_flag_code.jpg b/assets/feature_flag_code.jpg new file mode 100644 index 0000000..b55001f Binary files /dev/null and b/assets/feature_flag_code.jpg differ diff --git a/assets/feature_flag_code_logcat.jpg b/assets/feature_flag_code_logcat.jpg new file mode 100644 index 0000000..5cadcff Binary files /dev/null and b/assets/feature_flag_code_logcat.jpg differ diff --git a/assets/feature_flag_constant.jpg b/assets/feature_flag_constant.jpg new file mode 100644 index 0000000..f4bb3b1 Binary files /dev/null and b/assets/feature_flag_constant.jpg differ diff --git a/assets/feature_flag_json_name.jpg b/assets/feature_flag_json_name.jpg new file mode 100644 index 0000000..8ac36b2 Binary files /dev/null and b/assets/feature_flag_json_name.jpg differ diff --git a/assets/feature_flag_json_offer.jpg b/assets/feature_flag_json_offer.jpg new file mode 100644 index 0000000..811b7f3 Binary files /dev/null and b/assets/feature_flag_json_offer.jpg differ diff --git a/assets/feature_flag_validation.jpg b/assets/feature_flag_validation.jpg new file mode 100644 index 0000000..4326291 Binary files /dev/null and b/assets/feature_flag_validation.jpg differ diff --git a/assets/home_offer.jpg b/assets/home_offer.jpg new file mode 100644 index 0000000..351d331 Binary files /dev/null and b/assets/home_offer.jpg differ diff --git a/assets/home_offer_validation.jpg b/assets/home_offer_validation.jpg new file mode 100644 index 0000000..27d2925 Binary files /dev/null and b/assets/home_offer_validation.jpg differ diff --git a/assets/homeactivity.jpg b/assets/homeactivity.jpg new file mode 100644 index 0000000..4f06e4c Binary files /dev/null and b/assets/homeactivity.jpg differ diff --git a/assets/import.jpg b/assets/import.jpg new file mode 100644 index 0000000..9c819c4 Binary files /dev/null and b/assets/import.jpg differ diff --git a/assets/json_offers.jpg b/assets/json_offers.jpg new file mode 100644 index 0000000..cc3b88f Binary files /dev/null and b/assets/json_offers.jpg differ diff --git a/assets/layout_context_los_angeles.jpg b/assets/layout_context_los_angeles.jpg new file mode 100644 index 0000000..4502bb3 Binary files /dev/null and b/assets/layout_context_los_angeles.jpg differ diff --git a/assets/layout_context_san_diego.jpg b/assets/layout_context_san_diego.jpg new file mode 100644 index 0000000..a267053 Binary files /dev/null and b/assets/layout_context_san_diego.jpg differ diff --git a/assets/layout_home_validate.jpg b/assets/layout_home_validate.jpg new file mode 100644 index 0000000..1ce4f53 Binary files /dev/null and b/assets/layout_home_validate.jpg differ diff --git a/assets/layout_home_validate_avd_wipe.jpg b/assets/layout_home_validate_avd_wipe.jpg new file mode 100644 index 0000000..26b1002 Binary files /dev/null and b/assets/layout_home_validate_avd_wipe.jpg differ diff --git a/assets/layout_home_validate_logcat.jpg b/assets/layout_home_validate_logcat.jpg new file mode 100644 index 0000000..c8b7078 Binary files /dev/null and b/assets/layout_home_validate_logcat.jpg differ diff --git a/assets/layout_search_validate.jpg b/assets/layout_search_validate.jpg new file mode 100644 index 0000000..1794850 Binary files /dev/null and b/assets/layout_search_validate.jpg differ diff --git a/assets/lifecycle_code.jpg b/assets/lifecycle_code.jpg new file mode 100644 index 0000000..61d4b98 Binary files /dev/null and b/assets/lifecycle_code.jpg differ diff --git a/assets/lifecycle_validation.jpg b/assets/lifecycle_validation.jpg new file mode 100644 index 0000000..df9eb42 Binary files /dev/null and b/assets/lifecycle_validation.jpg differ diff --git a/assets/logcat_example.jpg b/assets/logcat_example.jpg new file mode 100644 index 0000000..8f7e342 Binary files /dev/null and b/assets/logcat_example.jpg differ diff --git a/assets/mboxparam1.jpg b/assets/mboxparam1.jpg new file mode 100644 index 0000000..f903154 Binary files /dev/null and b/assets/mboxparam1.jpg differ diff --git a/assets/offer_home.jpg b/assets/offer_home.jpg new file mode 100644 index 0000000..fe44de0 Binary files /dev/null and b/assets/offer_home.jpg differ diff --git a/assets/offer_home_1.jpg b/assets/offer_home_1.jpg new file mode 100644 index 0000000..b060943 Binary files /dev/null and b/assets/offer_home_1.jpg differ diff --git a/assets/offer_home_2.jpg b/assets/offer_home_2.jpg new file mode 100644 index 0000000..ff28096 Binary files /dev/null and b/assets/offer_home_2.jpg differ diff --git a/assets/offer_home_returning_users.jpg b/assets/offer_home_returning_users.jpg new file mode 100644 index 0000000..5b07bce Binary files /dev/null and b/assets/offer_home_returning_users.jpg differ diff --git a/assets/offer_los_angeles.jpg b/assets/offer_los_angeles.jpg new file mode 100644 index 0000000..13ff457 Binary files /dev/null and b/assets/offer_los_angeles.jpg differ diff --git a/assets/offer_returning_users.jpg b/assets/offer_returning_users.jpg new file mode 100644 index 0000000..a6f051f Binary files /dev/null and b/assets/offer_returning_users.jpg differ diff --git a/assets/offer_san_diego.jpg b/assets/offer_san_diego.jpg new file mode 100644 index 0000000..cb7c8e1 Binary files /dev/null and b/assets/offer_san_diego.jpg differ diff --git a/assets/offer_search.jpg b/assets/offer_search.jpg new file mode 100644 index 0000000..842471d Binary files /dev/null and b/assets/offer_search.jpg differ diff --git a/assets/overview_final_result.jpg b/assets/overview_final_result.jpg new file mode 100644 index 0000000..d503e1b Binary files /dev/null and b/assets/overview_final_result.jpg differ diff --git a/assets/parameters_at_property.jpg b/assets/parameters_at_property.jpg new file mode 100644 index 0000000..6b03bce Binary files /dev/null and b/assets/parameters_at_property.jpg differ diff --git a/assets/parameters_at_property_validation.jpg b/assets/parameters_at_property_validation.jpg new file mode 100644 index 0000000..4c2d295 Binary files /dev/null and b/assets/parameters_at_property_validation.jpg differ diff --git a/assets/parameters_live_location.jpg b/assets/parameters_live_location.jpg new file mode 100644 index 0000000..2460ff2 Binary files /dev/null and b/assets/parameters_live_location.jpg differ diff --git a/assets/parameters_live_location_validation.jpg b/assets/parameters_live_location_validation.jpg new file mode 100644 index 0000000..51621d8 Binary files /dev/null and b/assets/parameters_live_location_validation.jpg differ diff --git a/assets/params_at_property.jpg b/assets/params_at_property.jpg new file mode 100644 index 0000000..a1967b8 Binary files /dev/null and b/assets/params_at_property.jpg differ diff --git a/assets/personalize_layouts_home.jpg b/assets/personalize_layouts_home.jpg new file mode 100644 index 0000000..b165901 Binary files /dev/null and b/assets/personalize_layouts_home.jpg differ diff --git a/assets/personalize_layouts_search.jpg b/assets/personalize_layouts_search.jpg new file mode 100644 index 0000000..3351340 Binary files /dev/null and b/assets/personalize_layouts_search.jpg differ diff --git a/assets/prefetch_call.jpg b/assets/prefetch_call.jpg new file mode 100644 index 0000000..d40b818 Binary files /dev/null and b/assets/prefetch_call.jpg differ diff --git a/assets/prefetch_validation.jpg b/assets/prefetch_validation.jpg new file mode 100644 index 0000000..b133838 Binary files /dev/null and b/assets/prefetch_validation.jpg differ diff --git a/assets/prefetch_validation2.jpg b/assets/prefetch_validation2.jpg new file mode 100644 index 0000000..e8b7387 Binary files /dev/null and b/assets/prefetch_validation2.jpg differ diff --git a/assets/readme.md b/assets/readme.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/assets/readme.md @@ -0,0 +1 @@ + diff --git a/assets/searchBusActivity.jpg b/assets/searchBusActivity.jpg new file mode 100644 index 0000000..f7f9308 Binary files /dev/null and b/assets/searchBusActivity.jpg differ diff --git a/assets/target_location_dropdown.jpg b/assets/target_location_dropdown.jpg new file mode 100644 index 0000000..5e7d13e Binary files /dev/null and b/assets/target_location_dropdown.jpg differ diff --git a/assets/target_location_dropdown2.jpg b/assets/target_location_dropdown2.jpg new file mode 100644 index 0000000..6db2019 Binary files /dev/null and b/assets/target_location_dropdown2.jpg differ diff --git a/assets/target_ui.jpg b/assets/target_ui.jpg new file mode 100644 index 0000000..e7f6d5f Binary files /dev/null and b/assets/target_ui.jpg differ diff --git a/assets/thankyou.jpg b/assets/thankyou.jpg new file mode 100644 index 0000000..563d0d9 Binary files /dev/null and b/assets/thankyou.jpg differ diff --git a/assets/thankyou2.jpg b/assets/thankyou2.jpg new file mode 100644 index 0000000..54f958f Binary files /dev/null and b/assets/thankyou2.jpg differ diff --git a/assets/thankyou_validation.jpg b/assets/thankyou_validation.jpg new file mode 100644 index 0000000..381f06f Binary files /dev/null and b/assets/thankyou_validation.jpg differ diff --git a/assets/travel_app.jpg b/assets/travel_app.jpg new file mode 100644 index 0000000..d6fc141 Binary files /dev/null and b/assets/travel_app.jpg differ diff --git a/assets/travel_app2.jpg b/assets/travel_app2.jpg new file mode 100644 index 0000000..67c8070 Binary files /dev/null and b/assets/travel_app2.jpg differ diff --git a/assets/travel_app_2_locations.jpg b/assets/travel_app_2_locations.jpg new file mode 100644 index 0000000..c6da8d7 Binary files /dev/null and b/assets/travel_app_2_locations.jpg differ diff --git a/assets/validate_homeactivity.jpg b/assets/validate_homeactivity.jpg new file mode 100644 index 0000000..ebebaeb Binary files /dev/null and b/assets/validate_homeactivity.jpg differ diff --git a/assets/wetravel_engage_home_loadRequest.jpg b/assets/wetravel_engage_home_loadRequest.jpg new file mode 100644 index 0000000..a77435c Binary files /dev/null and b/assets/wetravel_engage_home_loadRequest.jpg differ diff --git a/assets/wetravel_engage_search_loadRequest.jpg b/assets/wetravel_engage_search_loadRequest.jpg new file mode 100644 index 0000000..c90da43 Binary files /dev/null and b/assets/wetravel_engage_search_loadRequest.jpg differ diff --git a/assets/workspace.jpg b/assets/workspace.jpg new file mode 100644 index 0000000..3d5d048 Binary files /dev/null and b/assets/workspace.jpg differ diff --git a/create-audiences-and-offers.md b/create-audiences-and-offers.md new file mode 100644 index 0000000..ac5efad --- /dev/null +++ b/create-audiences-and-offers.md @@ -0,0 +1,173 @@ +--- +title: Create Audiences and Offers in Adobe Target +seo-title: Create Audiences and Offers in Adobe Target +description: In this lesson, we'll build audiences and offers in Adobe Target for the three locations we implemented in the previous lessons. These will be used to display personalized experiences in the next lesson. +seo-description: In this lesson, we'll build audiences and offers in Adobe Target for the three locations we implemented in the previous lessons. These will be used to display personalized experiences in the next lesson. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Create Audiences and Offers in Adobe Target + +In this lesson, we'll build audiences and offers in Adobe Target for the three locations we implemented in the previous lessons. These will be used to display personalized experiences in the next lesson. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Create Audiences in Adobe Target** +* **Create Offers in Adobe Target for Each Location in your App** + +This lesson will require access to Adobe Target. Before moving on through the next steps, ensure you have access to Adobe Target, which is accessed through the Adobe Experience Cloud here: [https://experience.adobe.com/](https://experience.adobe.com/). Contact your Adobe Administrator for access. + +Select Adobe Target and you'll be logged in to the Target UI where you can create Audiences and Offers for this lesson. First, make sure that the correct Workspace is selected. A workspace is used to separate Target projects into groups so that projects can be categorized or separated for different users. Select the Workspace that you used in the previous lesson to copy the at_property value: + +![Workspace Example](assets/workspace.jpg) + +## Create Audiences for New and Returning Users + +Adobe Target Audiences are used to identify specific groups of visitors. Offers can then be targeted to those specific groups. For the first two locations, we'll use a "New Users" audience and a "Returning Users" audience. + +Messages for the first two locations will be displayed in the app as follows: + +| Audience | Location | Message | +| --- | --- | --- | +| New Users | wetravel_engage_home | "Select your Origin & Destination to search for available bus routes" | +| New Users | wetravel_engage_search | "Use filters to narrow down your search results" | +| Returning Users | wetravel_engage_home | "Welcome back! Use promo code BACK30 during checkout to get a 10% discount." | +| Returning Users | wetravel_engage_search | default content | + +The "wetravel_engage_home" and "wetravel_engage_search" locations are located on the home and search results screens. They will be used to help engage users to search for bus trips. We'll need audience segments built that target new and returning users so we can display relevant messages to users. Let's use the lifecycle metric "a.DaysSinceFirstUse" to build those audiences. + +>**Note about Lifecycle metrics:** +>All Lifecycle metrics and dimensions collected in the Target mobile SDK are prepended with "a" (a.DaysSinceFirstUse, a.DaySinceLastUse, etc.). These variables are available to use in Audiences. + +### Create the New Users Audience + +(1) Select Audiences +(2) Select Create Audience + +![Create a New User Audience](assets/audience_new_mobile_app_users_1.jpg) + +(3) Enter "New Mobile App Users" as the audience name +(4) Select "Add Rule" +(5) Select a "Custom" rule + +![Create a New User Audience](assets/audience_new_mobile_app_users_2.jpg) + +(6) Select a.Launches +(7) Select "is less than" +(8) Enter "5" +(9) Save the new audience + +![Create a New User Audience](assets/audience_new_mobile_app_users_3.jpg) + +### Create the Returning Users Audience + +Follow the same steps listed above to create an audience for users who return at 5 or more app launches. + +(1) Name the audience "Returning Mobile App Users" +(2) Use "a.Launches is greater than or equal to 5" as the custom rule +(3) Save the new audience + +![Create a Returning User Audience](assets/audience_returning_mobile_app_users.jpg) + +## Create Offers for New and Returning Users + +We'll create HTML offers to display these messages. As a reminder, offers are snippets of code/content, defined in the Target user interface (or with API), which are delivered in the Target response. In mobile apps, JSON offers are common. For this demo, we'll be using HTML offers, which display in plain text in the app. + +### Create the Home Screen New Users Offer + +First, let's create offers for the messages to New Users. In the Target interface, select Offers > Create HTML Offer: + +(1) Select Offers +(2) Select Create +(3) Select "HTML Offer" + +![Create Home Offer](assets/offer_home_1.jpg) + +(4) Name the offer "Home : Engage New Users" +(5) Enter "Select Source and Destination to search for available buses" as the HTML code +(6) Save the new offer + +![Create Home HTML Offer](assets/offer_home_2.jpg) + +### Create the Search Screen New Users Offer + +Repeat the steps above to create a new HTML offer for the Search screen: + +(1) Name the offer "Search : Engage New Users" +(2) Enter "Use filters to narrow down your search results" as the HTML code +(3) Save the new offer + +![Create Home HTML Offer](assets/offer_search.jpg) + +### Create the Home Screen Returning Users Offer + +Now let's create the Home HTML offer for Returning Users: + +(1) Name the offer "Home : Returning Users" +(2) Enter "Welcome back! Use promo code BACK30 during checkout to get a 10% discount." as the HTML code +(3) Save the new offer + +![Create Home HTML Offer](assets/offer_home_returning_users.jpg) + +The Search Screen offer for Returning Users will return default content (which is set to nothing), so there is no need to create an offer for Returning Users for the Search Screen. + +## Create Audiences for Users That Book Specific Destinations + +For this demo app, we'll focus on displaying offers for two trip destinations - San Diego and Los Angeles. The messages will be returned to the app as follows: + +| Audience | Location | Message | +| --- | --- | --- | +| Destination: San Diego | wetravel_context_dest | "DJ" | +| Destination: Los Angeles | wetravel_context_dest | "Universal" | + +When the "Universal" value is returned to the app, a banner for Universal Studios will display. When "DJ" is returned, a banner for "Rock Night with DJ SAM" will display. The idea is to display relevant recommendations based on destination after a booking. Let's first create two custom audiences in the Target interface: + +### Create the "Destination : San Diego" Audience + +(1) Name the audience "Destination : San Diego" +(2) Use a custom rule with this definition: "locationDest contains San Diego" +(3) Save the new audience + +![Create "San Diego" Audience](assets/audience_locationDest_san_diego.jpg) + +### Create the "Destination : Los Angeles" Audience + +(1) Name the audience "Destination : Los Angeles" +(2) Use a custom rule with this definition: "locationDest contains Los Angeles" +(3) Save the new audience + +![Create "Los Angeles" Audience](assets/audience_locationDest_los_angeles.jpg) + +## Create Offers for Destination Promotions + +Now we'll create HTML offers for these messages. + +### Create the San Diego Offer + +(1) Name the offer "Promotion for San Diego" +(2) Enter "DJ" as the HTML code +(3) Save the new offer + +![Create "San Diego" Offer](assets/offer_san_diego.jpg) + +### Create the Los Angeles Offer + +(1) Name the offer "Promotion for Los Angeles" +(2) Enter "Universal" as the HTML code +(3) Save the new offer + +![Create "Los Angeles" Offer](assets/offer_los_angeles.jpg) + +>Note: Our demo app contains custom logic that captures the destination value from the user's input. The logic then checks that value against the Target response and determines which banner to display. You may need to use similar logic in your own app in specific user scenarios. + +## Conclusion + +Now that Audiences and Offers are in place, we're ready to view the final experience. In the next lesson, we'll build activities and walk through the experience in the app. + +**[NEXT : "Personalize Layouts" >](personalize-layouts.md)** diff --git a/create-segments-and-offers.md b/create-segments-and-offers.md new file mode 100644 index 0000000..39443d3 --- /dev/null +++ b/create-segments-and-offers.md @@ -0,0 +1,37 @@ +--- +title: Adobe Target location request scenarios +description: Adobe Target mobile SDK methods can be used to display Target locations in several scenarios. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Create Audience Segments in Adobe Target + +In this lesson, we'll build audiences and offers in Adobe Target for the three locations we implemented in the previous lessons. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Create Audience Segments in Adobe Target** +* **Create Offers in Adobe Target for Each Location in your App** + +## Create Audience Segments in Adobe Target + +(Show how to build a custom segment for New App Users (with a.DaysSinceFirstUse < 2) ) +(Show how to build a custom segment for Returning Users after 30+ days (a.DaysSinceFirstUse > 30).) + +## Create "Engage" Offers for the First Location + +(Show how to build the offers & activity in Target) + +## Create "Search" Offers for the Second Location + +(Show how to build the offers & activity in Target) + +## Create "Destination" Offers for the Third Location + +(Show how to build the offers & activity in Target) \ No newline at end of file diff --git a/download-and-update-the-sample-app.md b/download-and-update-the-sample-app.md new file mode 100644 index 0000000..3a9c0be --- /dev/null +++ b/download-and-update-the-sample-app.md @@ -0,0 +1,57 @@ +--- +title: Download and Update the We.Travel Sample App +seo-title: Download the sample app and verify the mobile services SDK +description: The We.Travel sample app is pre-implemented with the Adobe Mobile Services SDK v4. You just need to update it so it points to your own Experience Cloud Org and solution accounts. +seo-description: The We.Travel sample app is pre-implemented with the Adobe Mobile Services SDK v4. You just need to update it so it points to your own Experience Cloud Org and solution accounts. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Download and Update the We.Travel Sample App + +The We.Travel sample app is pre-implemented with the Adobe Mobile Services SDK v4. You just need to update it so it points to your own Experience Cloud Org and solution accounts. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* Download and Open the We.Travel sample app in Android Studio +* Verify & Update the Mobile Services SDK Settings for Target + +## Download the We.Travel App + +* Download the [We.Travel App](https://github.com/adobe-target/sample-app-android/tree/SDKv4) +* Open the app in Android Studio as an existing project + +## Verify & Update the Mobile Services SDK Settings for Target + +The Adobe Mobile Services SDK has been preinstalled within the We.Travel app [according to the documentation](https://docs.adobe.com/content/help/en/mobile-services/android/getting-started-android/requirements.html). + +First, make sure the SDK is configured properly with your company settings for Adobe Target in Android Studio: + +1. Log in to the [Adobe Mobile Services interface](https://mobilemarketing.adobe.com) +2. Add a new app (if not already done) +3. Add your Target Client Code (you can find it in the Target interface under Setup > Implementation > Edit Settings (next to the Download at.js button) +4. Select the new app from the top left drop-down +5. Select "Manage App Settings" (or gear icon) +6. Scroll to the bottom and download the Config File: + +![Download the Config File](assets/config_file.jpg) + +Add (or replace) the ADBMobileConfig.json file in your Android Studio project assets folder (app > src > main > assets). + +Now open the ADBMobileConfig.json file and make sure your "Client Code" is added. If it's not already added, you can find it in the Target interface under Setup > Implementation > Edit Settings (next to the Download at.js button). +![Download the Config File](assets/client_code.jpg) + +## Import Target Classes + +The remaining lessons will use Adobe Target Java classes and functions for personalization. Import the Target classes at the top of the HomeActivity as shown in red below: + +![Import the Target Classes](assets/import.jpg) + +We will validate the configuration by validating Target requests in the next module. + +**[NEXT : "Add Target Requests" >](add-requests.md)** diff --git a/feature-flagging.md b/feature-flagging.md new file mode 100644 index 0000000..7df8087 --- /dev/null +++ b/feature-flagging.md @@ -0,0 +1,161 @@ +--- +title: Feature Flagging +seo-title: Feature Flagging +description: Adobe Target can be used to experiment with UX features like color, copy, buttons, text & images and provide those features to specific audiences. +seo-description: Adobe Target can be used to experiment with UX features like color, copy, buttons, text & images and provide those features to specific audiences. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Feature Flagging + +Mobile app product owners need the flexibility to roll out new features in their app without having to invest in multiple app releases. They may also want to roll out features gradually to a percentage of the user base, to test effectiveness. Adobe Target can be used to experiment with UX features like color, copy, buttons, text & images and provide those features to specific audiences. + +In this lesson, we'll create a "feature flag" offer which can be used as a trigger to enable specific app features. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Add a new location to the batch prefetch request** +* **Create a Target activity with an offer that will be used as a feature flag** +* **Load and validate the feature flag offer in your app** + +## Add a New Location to the Prefetch Request to the Home Activity + +In the demo app from our previous lessons, we'll add a new location called "wetravel_feature_flag_recs" to the prefetch request in the Home Activity and load it to the screen with a new Java method. + +>Note that one of the benefits of using a prefetch request is that adding a new request does not add any additional network overhead or cause additional load work since the request is packaged within the prefetch request + +First, verify that the wetravel_feature_flag_recs constant is added in the Constant.java file: + +![Add feature flag constant](assets/feature_flag_constant.jpg) + +Here is the code: + +```java +public static final String wetravel_feature_flag_recs = "wetravel_feature_flag_recs"; +``` + +Now add the location to the prefetch request and load a new function called processFeatureFlags(): + +![Feature Flag Code](assets/feature_flag_code.jpg) + +Here is the full updated code: + +```java +public void targetPrefetchContent() { + List prefetchList = new ArrayList<>(); + + Map params1; + params1 = new HashMap(); + params1.put("at_property", "7962ac68-17db-1579-408f-9556feccb477"); + + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_home, params1)); + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_engage_search, params1)); + prefetchList.add(Target.createTargetPrefetchObject(Constant.wetravel_feature_flag_recs, params1)); + + Target.TargetCallback prefetchStatusCallback = new Target.TargetCallback() { + @Override + public void call(final Boolean status) { + HomeActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + String cachingStatus = status ? "YES" : "NO"; + System.out.println("Received Response from prefetch : " + cachingStatus); + engageMessage(); + processFeatureFlags(); + setUp(); + + } + }); + }}; + Target.prefetchContent(prefetchList, null, prefetchStatusCallback); +} + +public void processFeatureFlags() { + Target.loadRequest(Constant.wetravel_feature_flag_recs, "", null, null, null, + new Target.TargetCallback(){ + @Override + public void call(final String s) { + runOnUiThread(new Runnable() { + @Override + public void run() { + System.out.println("Feature Flags : " + s); + if(s != null && !s.isEmpty()) { + //enable or disable features + } + } + }); + } + }); +} +``` + +### Validate the Feature Flag Request + +Once the code is added, run the Emulator on the Home Activity and watch Logcat for the updated response: + +![Validate feature flag location](assets/feature_flag_code_logcat.jpg) + +## Create a Feature Flag JSON Offer + +We'll now create a simple JSON offer that will act as a flag or trigger for a specific audience - the audience that would receive the feature roll-out in their app. In the Target interface, create a new offer: + +![Create Feature Flag JSON Offer](assets/feature_flag_json_offer.jpg) + +Let's name it "Feature Flag v1" with the value {"enable":1} + +![feature_flag_v1 JSON Offer](assets/feature_flag_json_name.jpg) + +## Create an Activity + +Now let's create an A/B activity with that offer. For detailed steps on creating an activity see the previous lesson. The activity will only need one audience for this example. In a live scenario, you may want to build out specific custom audiences for specific feature roll-outs, then set the activity to use those audiences. In this example, we'll just allocate traffic 50/50 (50% to visitors who would see the feature updates, and 50% to visitors who would see a standard experience). Here is the configuration for the activity: + +(1) Name the Activity to "Feature Flag" +(2) Select the "wetravel_feature_flag_recs" location +(3) Change the content to the "Feature Flag v1" JSON offer + +![Feature Flag Activity Config](assets/feature_flag_activity.jpg) + +Create a second experience that uses the default content + +(4) Select "Add Experience" to add experience B +(5) Select the "wetravel_feature_flag_recs" location +(6) Leave "Default Content" for the content +(7) Select "Next" to advance to Targeting + +![Feature Flag Activity Config](assets/feature_flag_activity_2.jpg) + +On the Targeting screen, verify that the Traffic Allocation method is set to the default setting (Manual) and that each experience has the default 50% allocation. + +(8) Select "Next" to advance to "Goals & Settings" + +![Feature Flag Activity Config](assets/feature_flag_activity_3.jpg) + +On the Goals & Settings screen, set the Primary Goal under Reporting Settings: + +(9) Set the Primary Goal to Conversion +(10) Set the action to "Viewed an Mbox". We'll use the "wetravel_context_dest" location. +(11) Select "Save & Close" + +![Feature Flag Activity Config](assets/feature_flag_activity_4.jpg) + +Activate the Activity on the Next Screen. + +## Validate the Feature Flag Request + +Now use the emulator to watch for the request. Since we set the targeting to 50% of users, there's a 50% you'll see the feature flag response contain the "{enable:1}" value. + +![Feature Flag Validation](assets/feature_flag_validation.jpg) + +If you don't see the "{enable:1}" value, that means you weren't targeted for the experience. For a temporary test, to force the offer to show, you could deactivate the activity, then edit the activity and change the traffic allocation to 100%, then save and validate again with the emulator. The offer should now return the "{enable:1}" value. + +In a live scenario, the "{enable:1}" response can be used to enable more custom logic in your app to display the specific feature set you want to show your target audience. + +## Conclusion + +Nice work! You now have the skills needed to roll-out features to specific user audiences. diff --git a/overview.md b/overview.md new file mode 100644 index 0000000..e4956ac --- /dev/null +++ b/overview.md @@ -0,0 +1,59 @@ +--- +title: Adobe Target location request scenarios +description: Adobe Target mobile SDK methods can be used to display Target locations in several scenarios. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Overview + +_Implement and Use Adobe Target with Adobe Mobile Services SDK v4 for Android_ is the perfect starting point for Android developers who are already using Adobe Mobile Services SDK v4 and want to start personalizing app experiences with Adobe Target. + +A demo Android app is provided for you to complete the tutorial, so you can learn the underlying techniques. After completing this tutorial, you should be ready to start implementing Target in your own Android app! + +After completing this tutorial you will be able to: + +* Validate the [Adobe Mobile Services SDK](https://docs.adobe.com/content/help/en/mobile-services/android/getting-started-android/requirements.html) setup +* Implement the following types of Target requests: + * Global Pre-Fetch of all Target content + * Blocking request (runs before App display) + * Non-Blocking request (runs in the background) + * Real-Time (non-caching) + * Cache Busting Re-Fetch +* Add parameters to requests for enhanced personalization, including geo-location +* Build Feature Flagging Activities (Using Target to roll out new features) +* Personalize Layouts & Offers +* Use Adobe Target Recommendations + +## Prerequisites + +In these lessons, it is assumed that you: + +* Have an Adobe Id and approver-level access to the Adobe Target interface +* Know your Adobe Target Client Code to direct Target calls to your own account. The Client Code is shown in the Adobe Target interface on the Setup > Implementation > Edit at.js settings screen +* Know your Adobe Experience Cloud Org Id +* Have access to and are familiar with the [Mobile Services user interface](https://mobilemarketing.adobe.com) +* Know your Analytics tracking server and have a report suite id you can use for this tutorial +* POI references? +* Have an IDE for Android mobile app development. This tutorial features [Android Studio](https://developer.android.com/studio/install) in various steps and screenshots + +If you do not have the required access to the Experience Cloud Solutions, reach out to your Experience Cloud Administrator. + +Also, it is assumed that you are familiar with Android development in Java. You do not need to be a master of Java to complete the lessons, but you will get more out of them if you can comfortably read and understand code. + +## About the Lessons + +In these lessons, you will implement Adobe Target into a demo app called "We.Travel" using your own Adobe Target account. The end result will display "engage" offers to new users that guide through the booking process. There is also a "contextual" offer on the final confirmation screen that recommends events or places based on the destination selected. The final personalization experiences will look like this: + +![We.Travel app final](assets/overview_final_result.jpg) + +After walking through implementation within the We.Travel app you will use a simple five-step process to guide your own app implementation requirement process. + +![Prepare your App & Configure the SDK settings, Implement Requests within your app, Validate Implemented Requests, Configure a Mobile Activity in Adobe Target, Validate the new Activity Experience within the App](assets/5Steps.jpg) + +Let's get started! + +**[NEXT : "Download and Update the Sample App" >](download-and-update-the-sample-app.md)** diff --git a/personalize-layouts.md b/personalize-layouts.md new file mode 100644 index 0000000..46619b5 --- /dev/null +++ b/personalize-layouts.md @@ -0,0 +1,214 @@ +--- +title: Personalize Layouts +seo-title: Personalize Layouts +description: In this final lesson, we'll build two personalization activities in Target for our Audiences. We'll load and display the activities in the app and validate that content is displaying at the right time in the right locations. +seo-description: In this final lesson, we'll build two personalization activities in Target for our Audiences. We'll load and display the activities in the app and validate that content is displaying at the right time in the right locations. +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Personalize Layouts + +In this final lesson, we'll build two personalization activities in Target for our Audiences. We'll load and display the activities in the app and validate that content is displaying at the right time in the right locations. + +## Learning Objectives + +At the end of this lesson, you will be able to: + +* **Build Activities in Adobe Target for Our Audiences** +* **Validate the Activities in the Demo App** + +## Create Activities in Adobe Target + +### First Activity - "Engage Users" + +Here is a summary of the activity we'll build: + +| Audience | Locations | Offers | +|---|---|---| +| New Mobile App Users | wetravel_engage_home, wetravel_engage_search | Home : Engage New Users, Search : Engage New Users | +| Returning Users | wetravel_engage_home, wetravel_engage_search | Home : Returning Users, default content | + +In the Target interface select the following: + +(1) Select "Activities" +(2) Select "Create Activity" +(3) Select "Experience Targeting" + +![Create Activity](assets/activity_create_1.jpg) + +(4) Select "Mobile App" +(5) Select the Form composer +(6) Select your workspace (the same workspace you used in previous lessons) +(7) Select your property +(8) Select Next + +![Create Activity](assets/activity_create_2.jpg) + +On the next screen, we'll add our first "Engage Users" experience: + +(9) Change the title to "Engage Users" +(10) Select the ellipsis > Change Audience + +![Experience A Change Audience](assets/activity_create_3.jpg) + +(11) Set the audience to "New Mobile App Users" +(12) Select "Done" + +![Experience A Audience](assets/activity_create_4.jpg) + +Now set the first offer for the first location: + +(13) Change the location to "wetravel_engage_home" +(14) Select the dropdown arrow next to Default Content and select "Change HTML Offer" + +![Experience A Audience](assets/activity_create_5.jpg) + +(15) Select the "Home : Engage New Users" offer +(16) Select "Done" + +![Experience A Audience](assets/activity_create_6.jpg) + +Now add the Search Screen offer on this same activity: + +(17) Select "Add Location" + +![Experience B Audience](assets/activity_create_7.jpg) + +(18) Select the "wetravel_engage_search" location +(19) Change the HTML offer + +![Experience B Audience](assets/activity_create_8.jpg) + +(20) Select the "Search : Engage New Users" offer +(21) Select "Done" + +![Experience B Audience](assets/activity_create_9.jpg) + +The configuration for the "New Mobile App Users" experience (Experience A) should now look like this: + +#### Experience A Configuration + +![Experience A Final](assets/activity_engage_users_a_final.jpg) + +Now create an experience for "Returning Mobile App Users" (Experience B). + +(1) Select "Add Experience Targeting" on the left + +![Experience B Audience](assets/activity_create_10.jpg) + +(2) Select the Audience "Returning Mobile App Users" +(3) Select "Done" + +![Experience B Audience](assets/activity_create_11.jpg) + +Now use the same process for Experience A to configure Experience B. The configuration for the "Returning Mobile App Users" experience (Experience B) should now look like this: + +#### Experience B Configuration + +![Experience B Final](assets/activity_engage_users_b_final.jpg) + +Select "Next" to advance to "Targeting": + +#### Targeting + +Use the defaults on this page +Select "Next" to advance to "Goals & Settings" + +![Engage Users Activity - Targeting Default](assets/activity_engage_users_targeting.jpg) + +#### Goals & Settings + +(1) Under the Reporting Settings, set the Primary Goal to "Conversion" +(2) Set the action to "Viewed an mbox" > "wetravel_context_dest" (the location on the purchase confirmation screen) +(2) Select "Save & Close" + +![Experience B Audience](assets/activity_create_12.jpg) + +Now activate the Activity on the next screen + +![Experience B Audience](assets/activity_create_13.jpg) + +Our first activity is now live and ready to test! + +### Second Activity - "Contextual Offers" + +Here is a summary of the second activity we'll build: + +| Audience | Location | Offers | +| --- | --- | --- | +| Destination: San Diego | wetravel_context_dest | Promotion for San Diego | +| Destination: Los Angeles | wetravel_context_dest | Promotion for Los Angeles | + +Repeat the same process as above for the next Activity. Name the Activity "Contextual Offers". The Final configuration for both experiences are shown below: + +### Experience A + +![Contextual Offers - Experience A](assets/activity_contextual_a_final.jpg) + +### Experience B + +![Contextual Offers - Experience B](assets/activity_contextual_b_final.jpg) + +Use the defaults for the Targeting step. + +#### Goals and Settings + +On the Goals & Settings step, we'll change the Primary Goal to the location on booking confirmation screen: + +(1) Under the Reporting Settings, set the Primary Goal to "Conversion" +(2) Set the action to "Viewed an mbox" > "any mbox" +(3) Select "Save & Close" + +![Contextual Offers - Experience](assets/activity_create_14.jpg) + +Activate the Activity on the next screen. + +Now our second activity is live and ready to test! + +## Validate the Home Offer + +Run the Emulator and watch for the first offer to display at the bottom of the home screen. If you're a returning user after 5 or more app launches, you would see the "welcome back" offer displayed. If you're a new user (less than 5 app launches), you should see the "new user" message: + +![Validate Home Offer](assets/layout_home_validate.jpg) + +If the new user offer doesn't display, try wiping the data for your emulator. This is done under Tools > AVD Manager. That will reset the app launches to 1 the next time you launch. + +![Wipe Emulator](assets/layout_home_validate_avd_wipe.jpg) + +You can also validate the response in Logcat by filtering for "wetravel_engage_home": + +![Validate Home Offer - Logcat](assets/layout_home_validate_logcat.jpg) + +## Validate the Search Offer + +Select San Diego as your destination and search for available buses. On the results screen, you should see the "use filters" message. If you're a returning user after 5 or more app launches, no message will appear here since default content is set for this location (which is blank): + +![Validate Search Offer](assets/layout_search_validate.jpg) + +## Validate the Contextual Offers on the Thank You Screen + +Now continue through the booking process: + +* Select a bus on the results screen +* Select a seat on the checkout screen +* Select "Credit Card" on the payment screen (leave the payment info blank - no actual booking will take place) + +Since San Diego was selected as the destination, you should see the "DJ SAM" offer banner on the confirmation screen: + +![Validate Context Offer - San Diego](assets/layout_context_san_diego.jpg) + +Now select "Done" and try another booking with Los Angeles as the destination. The confirmation screen should display the "Universal Studios" banner: + +![Validate Context Offer - Los Angeles](assets/layout_context_los_angeles.jpg) + +## Conclusion + +Congratulations! This concludes the Adobe Target SDK 4.x for Android Tutorial. You now have the skills to implement personalization in Android apps! You can refer to this documentation and demo app as a reference for your future projects. + +>Next: Feature Flagging is another feature that can be implemented with Adobe Target in Android. To learn about feature flagging, check out the next lesson. + +**[NEXT : "Feature Flagging" >](download-and-update-the-sample-app.md)** diff --git a/personalize-with-geolocation.md b/personalize-with-geolocation.md new file mode 100644 index 0000000..75c9f37 --- /dev/null +++ b/personalize-with-geolocation.md @@ -0,0 +1,13 @@ +--- +title: +seo-title: +description: +seo-description: +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Personalize with Geolocation diff --git a/recommendations.md b/recommendations.md new file mode 100644 index 0000000..444b39e --- /dev/null +++ b/recommendations.md @@ -0,0 +1,13 @@ +--- +title: +seo-title: +description: +seo-description: +feature: mobile +kt: kt-3040 +audience: developer +doc-type: tutorial +activity-type: implement +--- + +# Recommendations