Skip to content

Analytics Events

Ryan Wold edited this page Aug 29, 2024 · 5 revisions

Touchpoints and DAP are two TTS products commonly used by federal agencies for measuring public facing websites.

DAP tracks page view events by default.

Touchpoints-specific events

As of March 2024, embedded Touchpoints forms emit analytics events to a webpage's DOM, to enable additional tracking of user behavior related to forms.

Touchpoints emits these events to the DOM.

These events can be captured on webpage using code like:

document.addEventListener('onTouchpointsModalOpen', function() {
    console.log("fired onTouchpointsModalOpen event")
    // Emit events to DAP or GTM (choose one)
    //
    // 1. Emit event to DAP directly
    // gas4('dap_event', 'touchpoints', 'onTouchpointsModalOpen')
    //
    // or...
    //
    // 2. Emit event to DAP through GTM (Google Tag Manager)
    // this method requires additional setup in GTM
    // dataLayer.push({
    //     'event': 'dap_event',
    //     'event_category': 'touchpoints',
    //     'event_action': 'onTouchpointsModalOpen'
    // });
});
event name description
onTouchpointsFormLoaded Form loaded When the Touchpoint form loads in the DOM
onTouchpointsModalOpen Open modal When a user clicks the USWDS Primary Button to open the modal
onTouchpointsModalClose Close modal When a user closes the modal
onTouchpointsFormSubmission Submit form When a user clicks the form's "submit" button
onTouchpointsFormSubmissionSuccess Form succeeds When the form returns a successful response message
onTouchpointsFormSubmissionError Form error When the form returns an error response message
onTouchpointsFormNextPage Click next page When a user clicks a form's "Next" pagination button
onTouchpointsFormPreviousPage Click previous page When a user clicks a form's "Previous" pagination button
Clone this wiki locally