Edit in GitHubLog an issue

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:

KeyTypeRequiredDescription
mboxStringYesMbox 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.
selectorStringNoCSS selectors used to find the HTML elements. The event listeners will be attached to found elements.
typeStringNoRepresents a registered event type. It can be both HTML known events like: click, mousedown ,etc., as well as custom HTML events.
preventDefaultBooleanNoIndicates 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.
paramsObjectNoMbox parameters. An object of key-value pairs that has the following structure:
{ "param1": "value1", "param2": "value2"}
timeoutNumberNoTimeout in milliseconds.
If not specified, default value is used:
...timeoutInSeconds: 0.15...}
successFunctionNoA callback function used to signal that event has been reported.
errorFunctionNoA callback function used to signal that event could not be reported.

Example#

Copied to your clipboard
<a href="https://asite.com">click me!</a>

plus javaScript code to assign trackEvent:

Copied to your clipboard
1<script>
2$('a').click(function(event){
3 adobe.target.trackEvent({'mbox':'homePageHero'})
4});
5</script>

Or:

Copied to your clipboard
1adobe.target.trackEvent({
2 "mbox": "clicked-cta",
3 "params": {
4 "param1": "value1"
5 }
6});
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.