Skip to content

DAP Custom Event Tracking

MaroyaF edited this page Jul 3, 2024 · 9 revisions

Event Tracking - gas4()

Event tracking is not controlled with a parameter, but rather with a function called gas4()

All custom events must have this structure:

gas4('event','parameter');

Here is the breakdown of these values:

  • event: Required, must not be changed.

Specifies that this is an event. Example: 'form_start'

  • parameter: Required, should be customized.

Must be a object with key value pair. Example: 'form_name' : 'newsletter'

Virtual Pageviews

A “virtual” pageview is when you send a pageview hit to Google Analytics, even though a full page load has not actually occurred. This is common to do in scenarios where new content is presented to the user without a new page being requested and rendered by the browser. Virtual pageview tracking is not controlled with a parameter, but rather with a function called gas4(). Add the function below to track virtual page view

Code Snippet:

gas4('page_view', { 'page_location':'<page_location>', 'page_title':'<page_title>'} );

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Code Snippet Example:

<a href="#" onclick="gas4('page_view',{'page_location':'/cart/step1.html','page_title':'Cart - Step 1'});"><img src="nextbutton.png"></a>

Download Button Click

Add the function below to track when a user downloads a file using Download Button.

Code Snippet: gas4('file_download', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'file_name':'<file_name>', 'file_extension':'<file_extension>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Form Start

Add the function below to track the first time a user interacts with a form

Code Snippet: gas4('form_start', { 'form_name':'<form_name>', 'form_id':'<form_id>', 'form_destination':'<form_destination>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Form Progress

Add the function below to track when a user interacts with a form (recommended for multi step form)

Code Snippet: gas4('form_progress', { 'form_name':'<form_name>', 'form_step':'<form_step>', 'form_id':'<form_id>', 'form_destination':'<form_destination>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Content View

Add the function below to track when a user view an important content

Code Snippet: gas4('content_view', { 'content_id':'<content_id>', 'content_type':'<content_type>', 'content_name':'<content_name>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Social Share

Add the function below to track when a user shares content on social profile

Code Snippet: gas4('social_share', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'link_classes':'<link_classes>', 'social_network':'<social_network>', 'content_type':'<content_type>', 'section':'<section>', });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Social Click

Add the function below to track when a user clicks content on social profile

Code Snippet: gas4('social_click', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'link_classes':'<link_classes>', 'social_network':'<social_network>', 'content_type':'<content_type>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Image Click

Add the function below to track when a user clicks on a image

Code Snippet: gas4('image_click', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'link_classes':'<link_classes>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Call to Action (CTA) Click

Add the function below to track when a user clicks on a call to action

Code Snippet: gas4('cta_click', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'link_classes':'<link_classes>', 'outbound':'<outbound>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Navigation Click

Add the function below to track when a user click on a navigation menu

Code Snippet: gas4('navigation_click', { 'link_text':'<link_text>', 'link_domain':'<link_domain>', 'link_url':'<link_url>', 'link_id':'<link_id>', 'link_classes':'<link_classes>', 'outbound':'<outbound>', 'section':'<section>', 'menu_type':'<menu_type>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Was this page helpful Submit

Add the function below to track when a user submit the form Was this page helpful

Code Snippet:

gas4('was_this_helpful_submit', { 'choice':'<choice>', 'reason':'<reason>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

FAQ Click

Add the function below to track when a user expands/collapse a Frequently Asked Question in a page

Code Snippet: gas4('faq_click', { 'selection':'<selection>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Accordion Click

Add the function below to track when a user click on the Accordion

Code Snippet: gas4('accordion _click', { 'selection':'<selection>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Error

Add the function below to track when an error thrown for a specific action performed by the user

Code Snippet: gas4('error', { 'error_message':'<error_message>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Search Filter

Add the function below to track when a user selects sort option for a search term on the page

Code Snippet: gas4('accordion _click', { 'selection':'<selection>', 'section':'<section>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Search - Sort

Add the function below to track when a user selects a filter for a search term on the page

Code Snippet: gas4('filter', { 'selection':'<selection>', 'search_term':'<search_term>' });

Note: Javascript properties that are in red in the image are code examples and should be replaced by DAP users with their respective values.

image

Reporting Configuration Example:

image

Example:gas4()

image

Clone this wiki locally