Edit in GitHubLog an issue

Deprecated Target APIs

The following Target APIs are deprecated APIs that are no longer supported on AEPTarget version 3.x and newer, and are only present in ACPTarget 2.x.

Using the prefetch APIs

Java

Using the TargetPrefetch builder

The TargetPrefetch builder helps create a TargetPrefetch instance with the specified data. The returned instance can be used with prefetchContent, which accepts a TargetPrefetch object list to prefetch offers for the specified mbox locations.

Syntax

Copied to your clipboard
TargetPrefetch prefetchRequest = new TargetPrefetch.Builder("mboxName")
.setMboxParameters(new HashMap<String, String>())
.setOrderParameters(new HashMap<String, Object>())
.setProductParameters(new HashMap<String, String>())
.build();

Using prefetchContent

Sends a prefetch request to your configured Target server with the TargetPrefetch list and specified profileParameters. The callback is invoked when the prefetch is complete, which returns a success status for the prefetch request.

Syntax

Copied to your clipboard
public static void prefetchContent(final List<TargetPrefetch> targetPrefetchList,
final Map<String, Object> profileParameters,
final AdobeCallback<Boolean> callback);

Example

Copied to your clipboard
// first prefetch request
Map<String, Object> mboxParameters1 = new HashMap<>();
mboxParameters1.put("status", "platinum");
// second prefetch request
Map<String, Object> mboxParameters2 = new HashMap<>();
mboxParameters2.put("userType", "paid");
List<String> purchasedIds = new ArrayList<String>();
purchasedIds.add("34");
purchasedIds.add("125");
Map<String, Object> orderParameters2 = new HashMap<>();
orderParameters2.put("id", "ADCKKIM");
orderParameters2.put("total", "344.30");
orderParameters2.put("purchasedProductIds", purchasedIds);
Map<String, Object> productParameters2 = new HashMap<>();
productParameters2.put("id", "24D3412");
productParameters2.put("categoryId","Books");
TargetPrefetch prefetchRequest1 = new TargetPrefetch.Builder("mboxName1")
.setMboxParameters(mboxParameters1)
.build();
TargetPrefetch prefetchRequest2 = new TargetPrefetch.Builder("mboxName2")
.setMboxParameters(mboxParameters2)
.setOrderParameters(orderParameters2)
.setProductParameters(productParameters2)
.build();
List<TargetPrefetchObject> prefetchMboxesList = new ArrayList<>();
prefetchMboxesList.add(prefetchRequest1);
prefetchMboxesList.add(prefetchRequest2);
// Call the prefetchContent API.
Target.prefetchContent(prefetchMboxesList, profileParameters, prefetchStatusCallback);

Load Target requests

Sends a batch request to your configured Target server for multiple mbox locations that are specified.

When working with prefetch APIs, and switching to the new retrieveLocationContent API, if you do not use locationsDisplayed, reporting will not work.

TargetRequest Builder

TargetRequest builder helps create a TargetRequest instance. The returned instance can be used with loadRequests, which accepts a TargetRequest object list to retrieve offers for the specified mbox locations.

Example

Copied to your clipboard
TargetRequest request = new TargetRequest.Builder("mboxName","defaultContent")
.setMboxParameters(new HashMap<String, String>())
.setOrderParameters(new HashMap<String, Object>())
.setProductParameters(new HashMap<String, String>())
.setContentCallback(new AdobeCallback<String>() {
@Override
public void call(String value) {
// do something with target content.
}
}).build();

loadRequests

Sends a batch request to your configured Target server for multiple mbox locations that are specified in the TargetRequest list. Each object in the array contains a callback function, which is invoked when content is available for its given mbox location.

Syntax

Copied to your clipboard
public static void loadRequests(final List<TargetRequest> requestArray,
final Map<String, Object> profileParameters);

Example

Copied to your clipboard
// define parameters for first request
Map<String, Object> mboxParameters1 = new HashMap<>();
mboxParameters1.put("status", "platinum");
// define parameters for second request
Map<String, Object> mboxParameters2 = new HashMap<>();
mboxParameters2.put("userType", "paid");
List<String> purchasedIds = new ArrayList<String>();
purchasedIds.add("34");
purchasedIds.add("125");
Map<String, Object> orderParameters2 = new HashMap<>();
orderParameters2.put("id", "ADCKKIM");
orderParameters2.put("total", "344.30");
orderParameters2.put("purchasedProductIds", purchasedIds);
Map<String, Object> productParameters2 = new HashMap<>();
productParameters2.put("id", "24D3412");
productParameters2.put("categoryId","Books");
TargetRequest request1 = new TargetRequest.Builder("mboxName1", "defaultContent1")
.setMboxParameters(mboxParameters1)
.setContentCallback(new AdobeCallback<String>() {
@Override
public void call(String value) {
// do something with target content.
}
}).build();
TargetRequest request2 = new TargetRequest.Builder("mboxName2", "defaultContent2")
.setMboxParameters(mboxParameters2)
.setOrderParameters(orderParameters2)
.setProductParameters(productParameters2)
.setContentCallback(new AdobeCallback<String>() {
@Override
public void call(String value) {
// do something with target content.
}
}).build();
// Creating Array of Request Objects
List<TargetRequest> locationRequests = new ArrayList<>();
locationRequests.add(request1);
locationRequests.add(request2);
// Define the profile parameters map.
Map<String, Object> profileParameters = new HashMap<>();
profileParameters.put("ageGroup", "20-32");
// Call the targetLoadRequests API.
Target.loadRequests(locationRequests, profileParameters);

locationClicked

Sends a click notification to the configured Target server for a prefetched or regular mbox location. The click metric should be enabled for the provided location name in Target.

If a notification is sent for a prefetched mbox, its contents should already have been requested with loadRequests, which indicates that the mbox was viewed.

Java

Syntax

Copied to your clipboard
public static void locationClicked(final String mboxName,
final Map<String, String> mboxParameters
final Map<String, String> productParameters
final Map<String, Object> orderParameters
final Map<String, String> profileParameters);

Example

Copied to your clipboard
// Define Mbox parameters
Map<String, Object> mboxParameters = new HashMap<>();
mboxParameters.put("membership", "prime");
// Define Product parameters
Map<String, Object> productParameters = new HashMap<>();
productParameters.put("id", "CEDFJC");
productParameters.put("categoryId","Electronics");
List<String> purchasedIds = new ArrayList<String>();
purchasedIds.add("81");
purchasedIds.add("123");
purchasedIds.add("190");
// Define Order parameters
Map<String, Object> orderParameters = new HashMap<>();
orderParameters.put("id", "NJJICK");
orderParameters.put("total", "650");
orderParameters.put("purchasedProductIds", purchasedIds);
// Creating Profile parameters
Map<String, Object> profileParameters = new HashMap<>();
profileParameters.put("ageGroup", "20-32");
Target.locationClicked("cartLocation", mboxParameters, productParameters, orderParameters, profileParameters);

Public classes

TargetRequest

Using Builder to construct the TargetRequest Object has been deprecated. You should be using constructors instead.

Example

Copied to your clipboard
public class TargetRequest extends TargetObject {
/**
* Builder used to construct a TargetRequest object.
*/
@Deprecated
public static class Builder {
private TargetRequest targetRequest;
/**
* Create a TargetRequest Builder.
*
* @param mboxName String mbox name for this request
* @param defaultContent String default content for this request
*/
@Deprecated
public Builder(final String mboxName, final String defaultContent);
/**
* Set mbox parameters for this request.
*
* @param mboxParameters Map<String, String> mbox parameters
* @return this builder
*/
public Builder setMboxParameters(final Map<String, String> mboxParameters);
/**
* Set order parameters for this request.
*
* @param orderParameters Map<String, Object> order parameters
* @return this builder
*/
public Builder setOrderParameters(final Map<String, Object> orderParameters);
/**
* Set profile parameters for this request.
*
* @param productParameters Map<String, String> product parameters
* @return this builder
*/
public Builder setProductParameters(final Map<String, String> productParameters);
/**
* Set profile parameters for this request.
*
* @param profileParameters Map<String, String> profile parameters
* @return this builder
*/
public Builder setProfileParameters(final Map<String, Object> profileParameters);
/**
* Set Target parameters for this request.
*
* @param targetParameters TargetParameters object
* @return this builder
*/
public Builder setTargetParameters(final TargetParameters targetParameters);
/**
* Set the callback function for this request.
*
* @param contentCallback AdobeCallback<String> which will get called with the returning content
* @return this builder
*/
public Builder setContentCallback(final AdobeCallback<String> contentCallback);
/**
* Build the TargetRequest.
*
* @return TargetRequest the target request object
*/
public TargetRequest build();
}
}

TargetPrefetch

Using Builder to construct the TargetPrefetch Object has been deprecated. You should be using constructors instead.

Example

Copied to your clipboard
public class TargetPrefetch extends TargetObject {
/**
* Builder used to construct a TargetPrefetch object
*/
@Deprecated
public static class Builder {
private TargetPrefetch targetPrefetch;
/**
* Create a TargetPrefetch Builder.
*
* @param mboxName String mbox name for this request
*/
public Builder(final String mboxName);
/**
* Set mbox parameters for this request.
*
* @param mboxParameters Map<String, String> mbox parameters
* @return this builder
*/
public Builder setMboxParameters(final Map<String, String> mboxParameters);
/**
* Set order parameters for this request.
*
* @param orderParameters Map<String, String> order parameters
* @return this builder
*/
public Builder setOrderParameters(final Map<String, Object> orderParameters);
/**
* Set product parameters for this request.
*
* @param productParameters Map<String, String> product parameters
* @return this builder
*/
public Builder setProductParameters(final Map<String, String> productParameters);
/**
* Set profile parameters for this request.
*
* @param profileParameters Map<String, String> profile parameters
* @return this builder
*/
public Builder setProfileParameters(final Map<String, Object> profileParameters);
/**
* Set Target parameters for this request.
*
* @param targetParameters TargetParameters object
* @return this builder
*/
public Builder setTargetParameters(final TargetParameters targetParameters);
/**
* Build and return TargetPrefetch
*
* @return TargetPrefetch the target prefetch object
*/
public TargetPrefetch build();
}
}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.