Can we push click event to profile scripts?



I am trying to set profile cookies using profile scripts...

Scenario :

if (page.url.indexOf ("xx")  != -1)


"Click on CTA/button"

  user.setLocal('yy', "true");

Is it possible ? and how can this be done.


Accepted Solutions (1)

Accepted Solutions (1)





Keep in mind that profile scripts run on the Target server-side. So they have no visibility to client-side events (things that happen in the browser) unless the browser makes a call to Target with some data about the event.

So if you want to run a profile script on a click event you have to add a getOffer() or trackEvent() function to the onclick. In the trackEvent you can pass any necessary info in as parameters of the request. Then in the profile script I would add logic that only runs the script when the specific request I'm looking for (click event) is seen. Take any of the applicable data and read/store/parse it as needed.

As an example. If this code was on my page:

<a href="#" onclick="{mbox:'dataCapture', params:{'param1':'value1'}});">click here</a>

My profile script can look for an mbox name of 'dataCapture' (or whatever you choose to name the mbox). Then it can read my param1 value and do something with it.

if ( == 'dataCapture') {

    var x = mbox.param('param1');

    return x;


The profile script value can then but used to create an audience rule.

Answers (0)