Customizing form event tracking

Last update: 2023-12-06

Out of the box, the following events are tracked in an analytics enabled Adaptive Form:

Event Available variables
render formName, formTitle, formInstance, source
abandon formName, formTitle, formInstance, panelName, panelTitle
save formName, formTitle, formInstance, panelName, source
submit formName, formTitle, formInstance, source
error formName, formTitle, fieldName, fieldTitle, panelTitle
help formName, formTitle, fieldName, fieldTitle, panelTitle
fieldVisit formName, formTitle, fieldName, fieldTitle, panelTitle
panelVisit formName, formTitle, panelName, panelTitle

Customizing the field visit event timeout

On the default AEM form setup, if a user spends more than 60 seconds on a field, a fieldvisit event is triggered and the details of the field are sent to Adobe Analytics. You can customize the Field time tracking baseline under AEM Forms Analytics Configuration at AEM Configuration console (/system/console/configMgr?lang=en) to increase or decrease the timeout limit.

Customizing the tracking events

You can modify the trackEventfunction available in /libs/afanalytics/js/custom.js file to customize the event tracking. Whenever an event that is being tracked occurs in an adaptive form, the trackEventfunction is called. The trackEvent function accepts two parameters: eventNameand variableValueMap.

You can evaluate value of eventName and variableValueMap arguments to change the tracking behavior of events. For example, you can choose to send the information to analytics server after a certain number of error events occur. You can also choose to perform any of the following customizations:

  • You can set a threshold time before sending the event.

  • You can maintain a state to decide action, for example, fieldVisit pushes a dummy event based on the timestamp of the last event.

  • You can use the pushEvent function to send the event to analytics server .

  • You can choose to not push the event to analytics server at all.


In the following example, state for the error event of each fieldName attribute is maintained. The event is sent to the analytics server only if an error occurs again.

case 'error':
        if(errorOccurred[variableValueMap.fieldName] == true) {
            pushEvent(eventName, variableValueMap)
        errorOccurred[variableValueMap.fieldName] = true;

Customizing the panelvisit event

On the default AEM Forms setup, after every 60 seconds, it is checked if the window containing the adaptive form is active. If the window is active, a panelVisitevent is triggered to Adobe Analytics. It helps in ascertaining that the document or the form is active and calculating time spent on the corresponding form or document.


The event name used to acertain activity and calculating time spent is “panelVisit”. This event is different from the panel visit event listed in the table listed above.

You can modify the scheduleHeartBeatCheck function available in the /libs/afanalytics/js/custom.js file to change or stop this event sent to Adobe Analytics at a regular interval.

On this page