AAM segments
Adobe Audience Manager segments can be leveraged via Adobe Target SDKs. In order to leverage AAM segments, the following fields need to be provided:
locationHint
marketingCloudVisitorId
blob
The SDK will automatically populate these fields for you when making a getOffers
method call, but you will need to ensure a valid visitor cookie is provided. In order to get this cookie, you need to implement VisitorAPI.js in the browser.
Implementation Guide
Use of Cookies
Cookies are used to correlate Adobe Audience Manager requests with Adobe Target requests. These are the cookies used in this implementation.
AMCVS_XXXXXXXXXXXXXXXXXXXXXXXX%40AdobeOrg
VisitorAPI.js
when it is initialized with visitorState
from the target getOffers
response.mbox
targetCookie
from the target getOffers
response.Overview of steps
Suppose a user enters a URL into a browser which sends a request to your web server. When fulfilling that request:
-
The server reads the visitor and target cookies from the request.
-
The server makes a call to the
getOffers
method of the Target SDK, specifying the visitor and target cookies if available. -
When the
getOffers
call is fulfilled, values fortargetCookie
andvisitorState
from the response are used.- A cookie is set on the response with values taken from
targetCookie
. This is done using theSet-Cookie
response header, which tells the browser to persist the target cookie. - An HTML response is prepared that initializes
VisitorAPI.js
and passes invisitorState
from the target response.
- A cookie is set on the response with values taken from
-
The HTML response is loaded in the browser…
VisitorAPI.js
is included in the document header.- VisitorAPI is initialized with
visitorState
from thegetOffers
SDK response. This will cause the visitor cookie to be set in the browser so it will be sent to the server on subsequent requests.
Example code
The following code sample implements each of the steps outlined above. Each step appears in the code as an inline comment next to its implementation.
Node.js
This sample relies on express, a Node.js web framework.
code language-js line-numbers |
---|
|
code language-html line-numbers |
---|
|
Java
This sample uses spring, a Java web framework.
code language-java line-numbers |
---|
|
code language-java line-numbers |
---|
|
code language-java line-numbers |
---|
|
code language-java line-numbers |
---|
|
For more information about TargetRequestUtils.java
, see Utility Methods (Java)