Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
cda8398
Add files via upload
kumarnimit Aug 23, 2019
83656c4
Create readme.md
kumarnimit Aug 23, 2019
698b0c5
Add files via upload
kumarnimit Aug 23, 2019
6b50104
Update mpc-adobe-target-mobile-app-scenarios.md
jtomlinson79 Aug 23, 2019
cca8d1a
Added "SDK version 4" to both docs, cleaned footer
jtomlinson79 Aug 23, 2019
683c440
Add files via upload
jtomlinson79 Aug 23, 2019
b71d44a
Added reference to "v4" to title
jtomlinson79 Aug 23, 2019
041babc
Added references to "version 4"
jtomlinson79 Aug 23, 2019
494723d
Add files via upload
jtomlinson79 Sep 20, 2019
e88e2a9
Add files via upload
jtomlinson79 Sep 24, 2019
0c96c18
Add files via upload
jtomlinson79 Sep 24, 2019
d3712f4
deleting "v2" docs
dwright-adobe Sep 26, 2019
308c2ba
Delete mpc-target-mobile-app-validation V2.md
dwright-adobe Sep 26, 2019
60f3e61
cleaning up markdown for publishing
dwright-adobe Sep 26, 2019
112e3ef
updating markdown for publishing system
dwright-adobe Sep 26, 2019
ef5c707
renamed images folder assets
dwright-adobe Sep 26, 2019
2e7d604
Add files via upload
jtomlinson79 Oct 2, 2019
4390615
dwright updates
dwright-adobe Oct 14, 2019
ad8e87b
Merge branch 'mpc-docs' into patch-1
dwright-adobe Oct 14, 2019
d0c9648
Merge pull request #3 from dwright-adobe/patch-1
dwright-adobe Oct 14, 2019
251ea2e
adding images
dwright-adobe Oct 14, 2019
d98b028
Merge pull request #4 from dwright-adobe/patch-1
dwright-adobe Oct 14, 2019
7fccd52
Add files via upload
jtomlinson79 Oct 24, 2019
4c3484a
Add files via upload
jtomlinson79 Oct 24, 2019
455623e
Add files via upload
jtomlinson79 Oct 25, 2019
d7f670d
Add files via upload
jtomlinson79 Oct 25, 2019
fd5c31a
Metric Partners - Milestone 1 Updates
jtomlinson79 Oct 26, 2019
4dd0c27
Add files via upload
jtomlinson79 Oct 26, 2019
49d0ace
Add files via upload
jtomlinson79 Oct 26, 2019
2541e5e
Delete add-requests-prefetch.md
jtomlinson79 Oct 29, 2019
d8a06c8
Delete add-requests-real-time.md
jtomlinson79 Oct 29, 2019
3ef6e42
Delete download-validate-and-update-the-sample-app.md
jtomlinson79 Oct 29, 2019
0e97b94
Delete for-reference-prefetch-5-steps.md
jtomlinson79 Oct 29, 2019
c76445a
Delete mpc-adobe-target-mobile-app-scenarios.md
jtomlinson79 Oct 29, 2019
7d9d469
Delete mpc-target-mobile-app-validation.md
jtomlinson79 Oct 29, 2019
aa3834a
Add files via upload
jtomlinson79 Oct 29, 2019
537231b
Add files via upload
jtomlinson79 Nov 5, 2019
6ce625e
Add files via upload
jtomlinson79 Nov 5, 2019
d7a9cfa
Add files via upload
jtomlinson79 Nov 5, 2019
b4f21bb
updated title and URL
dwright-adobe Nov 8, 2019
5936a74
misc updates, removed a few meta fields
dwright-adobe Nov 8, 2019
6ac7f64
misc updates, removed some meta fields
dwright-adobe Nov 8, 2019
d0512f6
made Terminology second level heading
dwright-adobe Nov 8, 2019
35039ea
Fixed screenshots 2, 4, 5
jtomlinson79 Nov 21, 2019
5803edf
Add files via upload
jtomlinson79 Nov 21, 2019
df13903
Add files via upload
jtomlinson79 Jan 8, 2020
cee9cc4
Add files via upload
jtomlinson79 Jan 8, 2020
d92ff8e
Add files via upload
jtomlinson79 Jan 8, 2020
4819597
Add files via upload
jtomlinson79 Jan 16, 2020
1495715
Add files via upload
jtomlinson79 Jan 16, 2020
8486908
Add files via upload
jtomlinson79 Jan 17, 2020
119318f
Add files via upload
jtomlinson79 Jan 17, 2020
c950bb1
Add files via upload
jtomlinson79 Feb 5, 2020
c1619a5
Add files via upload
jtomlinson79 Feb 5, 2020
448598b
Add files via upload
jtomlinson79 Feb 5, 2020
bdab009
Add files via upload
jtomlinson79 Feb 10, 2020
811102b
Add files via upload
jtomlinson79 Feb 10, 2020
99e1fc3
Add files via upload
jtomlinson79 Feb 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
@@ -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)
146 changes: 146 additions & 0 deletions add-parameters.md
Original file line number Diff line number Diff line change
@@ -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<TargetPrefetchObject> prefetchList = new ArrayList<>();

Map<String, Object> params1;
params1 = new HashMap<String, Object>();
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<Boolean> prefetchStatusCallback = new Target.TargetCallback<Boolean>() {
@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<Recommandation> recommandations) {
Map<String, Object> 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<String>() {
@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.

<!--Add this style for CTA on all pages-->
**[NEXT : "Create Audiences and Offers" >](create-segments-and-offers.md)**
<!--Rename segments to audiences in file & titles-->
Loading