adobe.target.trackEvent(options)
This function fires a request to report user actions, such as clicks and conversions. It does not deliver activities in the response.
These event-tracking mbox calls can then be used to define metrics in activities. For more information, see Success Metrics and Track Conversions.
Here are the API details:
Mbox name
Note: If a trackEvent() call is fired with an mbox name that has already fired on the page, the SDID of trackEvent() is reset and will be different than the Target calls on the page. However, firing a trackEvent() call with a different mbox name keeps the trackEvent() call’s SDID consistent with the Page Load Request/triggerView() calls on the page.
Indicates whether to use event.preventDefault()
in the event listener callback. Defaults to false.
Note: Only form[submit]
and a[click]
are supported. Other scenarios are not supported due to complexity and huge amount of scenarios to support.
Mbox parameters. An object of key-value pairs that has the following structure:
{ "param1": "value1", "param2": "value2"}
Timeout in milliseconds.
If not specified, default value is used:
...timeoutInSeconds: 0.15...}
Example
<a href="https://asite.com">click me!</a>
plus javaScript code to assign trackEvent
:
<script>
$('a').click(function(event){
adobe.target.trackEvent({'mbox':'homePageHero'})
});
</script>
Or:
adobe.target.trackEvent({
"mbox": "clicked-cta",
"params": {
"param1": "value1"
}
});