I am trying to manually track clicks on a website using adobe Target via Web SDK, Im used to use getOffer/Apply offer for custom click tracking, Im aware this does not work anymore on web SDK, but looking up for the documentation, it says that you can use adobe.target.sendNotifications() but is not working either, it throws an error saying that sendNotifications is not defined. How can I send a custom event then?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Yes, in the code I provided the if statement is empty:
if (result.propositions) {
// Manually render propositions and send "display" event
}
So if you change it to the following then you'd see the response from Target output to console
if (result.propositions) {
console.log(result.propositions)
}
The idea with this custom mbox approach is that you write code that handles everything in the result.propositions response i.e., parse through the response and render the offer content in the appropriate location. If you don't want to do any of this manual work then you could use the default '__view__' mbox and set up your activity via the Visual Editor Composer; the Web SDK would then take care of automatically rendering the response from Target
Thank you @alexbishop
I assume, the correct way would be using the alloy sendevent function, but how the goal of 'View an mbox' from Adobe Target can be fullfilled with the sendevent funtion, woul this be correct?
You could use the following if you've implemented Web SDK with XDM
alloy("sendEvent", {
"type": "decisioning.propositionDisplay",
"xdm": {
"_experience": {
"decisioning": {
"propositions": [{
"scope": "xdmClick" // Or any mbox/location name you want to use in Adobe Target
}]
}
}
}
});
Or have you implemented Web SDK more recently and are solely using the data.__adobe.target approach?
Hi @alexbishop
We are using xdm on the implementation, so with the code you provided, it would work as 'view an mbox' metric on targer (xdmClick)??
Yes, exactly, the Metric configuration would look like this
Thanks for the answer, would that code trigger any activity set with the trigger 'xdmClick' as the triggering location mbox?
The default behaviour is that the metric will increment against all of the activities the user is qualified for, which use that same success metric. If you want to adjust that default behaviour, there is some more useful information here, in terms of advanced settings like creating dependencies etc, in case you haven't already seen it.
Hi @alexbishop
What I meant, is if that code that is used to count conversions, is the same for triggering activities using a custom mbox (what used to be the getOffer -> applyOffer function) for a configuration like this:
Ah ok, for custom mbox activities you just need to pass the name of the mbox in the decisionScopes array. For example:
alloy("sendEvent", {
"xdm": {},
"decisionScopes": ['activityOneMbox', 'activityTwoMbox']
}).then(function(result) {
if (result.propositions) {
// Manually render propositions and send "display" event
}
});
You'd likely also be sending some additional attributes as part of the xdm object, so the example above is just to illustrate the decisionScopes aspect. There's a full explanation here
Following with mi last question, I tried to configure an activity based on the custom mbox like this:
and then, executing the code you provided on console:
Even when the preview on console is showing the activity and its code, no code is being executed on the page, am I doing something wrong?
Thank you for your help
Yes, in the code I provided the if statement is empty:
if (result.propositions) {
// Manually render propositions and send "display" event
}
So if you change it to the following then you'd see the response from Target output to console
if (result.propositions) {
console.log(result.propositions)
}
The idea with this custom mbox approach is that you write code that handles everything in the result.propositions response i.e., parse through the response and render the offer content in the appropriate location. If you don't want to do any of this manual work then you could use the default '__view__' mbox and set up your activity via the Visual Editor Composer; the Web SDK would then take care of automatically rendering the response from Target
Views
Likes
Replies