Can we use Adobe Target Profile Scripts to build up audiences based on the click event?

Description

For this scenario we would like to use Profile Scripts to track click events on the page and be able to build audiences based on the collected data.

Resolution

Keep in mind that Profile Scripts run on Target server-side, this means they have no visibility of client-side events (events that happen in the user browser) unless the browser makes a call to Target passing the relevant data.

So if you want to run a profile script on a click event you have to add a getOffer() or trackEvent() function to listen to the onclick event. In the trackEvent() you can pass any necessary data as parameters within the request. Then in the profile script you should add logic that only runs the script when the specific request being tracked (onclick event) is executed. Next, take any of the applicable data and read/store/parse it as needed.

As an example, by using this code on a webpage:

a href=“#” onclick="adobe.target.trackEvent({mbox:‘dataCapture’, params:{‘param1’:‘value1’}});"click here/a

My profile script can look for an mbox named ‘dataCapture’ (or any other mbox name you have defined), then it could read my param1 value for further utilisation, e.g.:

if (mbox.name == ‘dataCapture’) {

var x = mbox.param(‘param1’);

return x;

}

The profile script value (‘param1’) can then be used to create an audience rule.

Please note the code above is only a sample, make sure your code logic surfaces the requirements of your use case.

On this page