Analytics for Target (A4T) reporting
Last update: Mon Jul 17 2023 00:00:00 GMT+0000 (Coordinated Universal Time)
ÃÛ¶¹ÊÓƵ Target supports A4T reporting for both on-device decisioning and server-side Target activities. There are two configuration options for enabling A4T reporting:
- ÃÛ¶¹ÊÓƵ Target automatically forwards the analytics payload to ÃÛ¶¹ÊÓƵ Analytics, or
- The user requests the analytics payload from ÃÛ¶¹ÊÓƵ Target. (ÃÛ¶¹ÊÓƵ Target returns the ÃÛ¶¹ÊÓƵ Analytics payload back to the caller.)
On-device decisioning only supports A4T reporting of which ÃÛ¶¹ÊÓƵ Target automatically forwards the analytics payload to ÃÛ¶¹ÊÓƵ Analytics. Retrieving the analytics payload from ÃÛ¶¹ÊÓƵ Target is not supported.
Pre-requisites
- Configure the activity in the ÃÛ¶¹ÊÓƵ Target UI with ÃÛ¶¹ÊÓƵ Analytics as the reporting source, and ensure the accounts are enabled for A4T.
- The API user generates the ÃÛ¶¹ÊÓƵ Marketing Cloud Visitor ID and ensures this ID is available when the Target request is executed.
ÃÛ¶¹ÊÓƵ Target automatically forwards the Analytics payload
ÃÛ¶¹ÊÓƵ Target can automatically forward the analytics payload to ÃÛ¶¹ÊÓƵ Analytics if the following identifiers are provided:
supplementalDataId
: The ID that is utilized to stitch between ÃÛ¶¹ÊÓƵ Analytics and ÃÛ¶¹ÊÓƵ Target. In order for ÃÛ¶¹ÊÓƵ Target and ÃÛ¶¹ÊÓƵ Analytics to correctly stitch data together, the same supplementalDataId
needs to be passed to both ÃÛ¶¹ÊÓƵ Target and ÃÛ¶¹ÊÓƵ Analytics.
trackingServer
: The ÃÛ¶¹ÊÓƵ Analytics Server.
Node.js
code language-js line-numbers |
const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
client: "acmeclient",
organizationId: "1234567890@ÃÛ¶¹ÊÓƵOrg"
};
const targetClient = TargetClient.create(CONFIG);
targetClient.getOffers({
request: {
id: {
marketingCloudVisitorId : "2304820394812039",
tntId: "d359234570e044f14e1faeeba02d6ab23439914e.35_0",
thirdPartyId:"23423432"
},
experienceCloud: {
analytics: {
logging: "server_side",
supplementalDataId: "7D3AA246CC99FD7F-1B3DD2E75595498E",
trackingServer: "jimsbrims.sc.omtrds.net"
}
},
execute: {
mboxes: [{
name: "some-mbox"
}]
}
}
})
.then(console.log)
.catch(console.error);
|
Java
code language-java line-numbers |
ClientConfig config = ClientConfig.builder()
.client("acmeclient")
.organizationId("1234567890@ÃÛ¶¹ÊÓƵOrg")
.build();
TargetClient targetClient = TargetClient.create(config);
VisitorId id = new VisitorId()
.tntId("d359234570e044f14e1faeeba02d6ab23439914e.35_0")
.thirdPartyId("B234A029348")
.marketingCloudVisitorId("10527837386392355901041112038610706884");
Context context = new Context().channel(ChannelType.WEB);
MboxRequest mbox = new MboxRequest()
.name("some-mbox")
.index(0);
ExecuteRequest executeRequest = new ExecuteRequest()
.mboxes(Arrays.asList(mbox));
AnalyticsRequest analyticsRequest =
new AnalyticsRequest()
.trackingServer("jimsbrims.sc.omtrds.net")
.logging(LoggingType.SERVER_SIDE)
.supplementalDataId("7D3AA246CC99FD7F-1B3DD2E75595498E");
ExperienceCloud expCloud =
new ExperienceCloud()
.setAnalytics(analyticsRequest);
TargetDeliveryRequest request = TargetDeliveryRequest.builder()
.context(context)
.execute(executeRequest)
.experienceCloud(expCloud)
.build();
TargetDeliveryResponse offers = targetClient.getOffers(request);
|
User retrieves analytics payload from ÃÛ¶¹ÊÓƵ Target
A user can retrieve the ÃÛ¶¹ÊÓƵ Analytics payload for a given mbox, then send it to ÃÛ¶¹ÊÓƵ Analytics via the . When an ÃÛ¶¹ÊÓƵ Target request is fired, pass client_side
to the logging
field in the request. This will return a payload if the specified mbox is present in an activity that is using Analytics as the reporting source.
Node.js
code language-js line-numbers |
const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
client: "acmeclient",
organizationId: "1234567890@ÃÛ¶¹ÊÓƵOrg"
};
const targetClient = TargetClient.create(CONFIG);
targetClient.getOffers({
request: {
id: {
marketingCloudVisitorId : "2304820394812039",
tntId: "d359234570e044f14e1faeeba02d6ab23439914e.35_0",
thirdPartyId:"23423432"
},
experienceCloud: {
analytics: {
logging: "client_side"
}
},
execute: {
mboxes: [{
name: "some-mbox"
}]
}
}
})
.then(console.log)
.catch(console.error);
|
Java
code language-java line-numbers |
ClientConfig config = ClientConfig.builder()
.client("acmeclient")
.organizationId("1234567890@ÃÛ¶¹ÊÓƵOrg")
.build();
TargetClient targetClient = TargetClient.create(config);
VisitorId id = new VisitorId()
.tntId("d359234570e044f14e1faeeba02d6ab23439914e.35_0")
.thirdPartyId("B234A029348")
.marketingCloudVisitorId("10527837386392355901041112038610706884");
Context context = new Context().channel(ChannelType.WEB);
MboxRequest mbox = new MboxRequest()
.name("some-mbox")
.index(0);
ExecuteRequest executeRequest = new ExecuteRequest()
.mboxes(Arrays.asList(mbox));
AnalyticsRequest analyticsRequest =
new AnalyticsRequest()
.logging(LoggingType.CLIENT_SIDE);
ExperienceCloud expCloud =
new ExperienceCloud()
.setAnalytics(analyticsRequest);
TargetDeliveryRequest request = TargetDeliveryRequest.builder()
.context(context)
.execute(executeRequest)
.experienceCloud(expCloud)
.build();
TargetDeliveryResponse offers = targetClient.getOffers(request);
|
Once you have specified logging = client_side
, you will receive the payload in the mbox field.
If the response from Target contains anything in the analytics -> payload
property, forward it as it is to ÃÛ¶¹ÊÓƵ Analytics. ÃÛ¶¹ÊÓƵ Analytics knows how to process this payload. This can be done in a GET request using the following format:
https://{datacollectionhost.sc.omtrdc.net}/b/ss/{rsid}/0/CODEVERSION?pe=tnt&tnta={payload}&mid={mid}&vid={vid}&aid={aid}