The following will help you track searches of VA.gov of content, including but not limited to:

  • Type Ahead Search

  • Resources and Support Search

  • Find Forms Search

  • Yellow Ribbon Search

This specification tracks both the search itself and the clicking of search results.

On Search

Description of When To Use

Data Layer Specification

Dev Notes

When the user has performed a search AND search results have been returned

For type ahead search, this is implemented just prior to next page load when the user lands on /search

Please be sure to push `undefined` for any variable that is not available from the system

For all non-type ahead search, please push Boolean value false for search-typeahead-enabled

Example of search-filters-list used for Yellow Ribbon Search { stateOrTerritory: //state, city: //city name, contributionAmount: "unlimited" //or undefined if not used, numberOfStudents: "unlimited" //or undefined if not used}

Type Ahead Search Specific - Other Search Products to Ignore

Description of When To Use

Data Layer

Dev Notes

When the next page load for a typeahead search has occurred

Exclusively used on type ahead search for the purpose of maintaining consistent metadata extraction while coping with the difficulty of the timing between when search is executed, next page load, and search result metadata is returned

{
    'event': 'view_search_results',

    //without www.va.gov hostname, the page path where the search occurred
    'search-page-path':  'www.va.gov/xxxxx',
    //full query input from the user
    'search-query': 'xxxxxxx',

    //true when the user has typeahead enabled
    'search-typeahead-enabled': 'xxxxx',

    //scope of search, values include: 'All VA.gov','Resources and Support','Yellow Ribbon', 'Find Forms'
    'search-selection':  'xxxxx',

    //key value pairs of search filter parameters
    'search-filters-list': {},

    //type ahead option selected by user to perform search
    'type-ahead-option-keyword-selected': "word",

    //full array list of type ahead options presented to user at time of search
    'type-ahead-options-list': [],

    //rank position chosen from type ahead options list
    'type-ahead-option-position': 0,

    //true only when the header search box is used, otherwise false
    'sitewide-search-app-used': false,

    //full count of search results returned
    'search-results-total-count': 0,

    //full count of search result pages returned
    'search-results-total-pages': 0,
}
JS

See above dev notes for consistencies

On Search Results Click

Description/Screenshot of Interaction

Data Layer

Dev Notes

When the user has clicked on a search result from the search results list

'event': 'onsite-search-results-click',
'search-result-type': 'title' //dynamically populate with 'pdf', if pd for 'cta' if a cta click
'search-filters-list': { stateOrTerritory: //state, city: //city name, contributionAmount: "unlimited" //or undefined if not used, numberOfStudents: "unlimited" //or undefined if not used}
'search-results-top-recommendation': true|false //populate boolean according to if result clicked was a top recommendation'search-selection': 'All VA.gov' //dynamically changed according to search application + scope
'search-result-chosen-page-url': https://benefits.va.gov/benefits //dynamically populate accoding to the url href
'search-result-chosen-title': Veterans Benefits Administration Home' //dynamically populate with the top level title
'search-query': 'health assessment',
'search-results-total-count': 999,
'search-results-total-pages': <total_result_pages>,
'search-result-position': 4'search-result-page': 1
JS

The position number should reflect the position on the page, for example, if 10 results are returned and the first result is clicked, 'search-result-position' should populate with 1

If introducing a search result type that is not a title, PDF, or CTA, please ask analytics team for what this value should populate with

On Search Result Change

Description/Screenshot of Interaction

Data Layer

Dev Notes

When the orientation of the way search results are presented is changed, either with filtering or sorting

'event': 'onsite-search-results-change',
'search-query': '10-10EZ', //dynamically populate with the search query
'search-page-path': '/find-forms', //dynamically populate with where the search occured
'search-results-change-action-type': 'sort', //dynamically populate with 'sort' or 'filter'
'search-results-change-action-label': 'newest', //'oldest' //populate according to the text label of user selection indicating the more specific action
'search-results-pagination-current-page': 1, //populate with the current pagination number
'search-results-total-count': 999, //populate with the total number of search results
'search-results-total-pages': 100, //populate with total number of result pages
JS

Pagination of search results is tracked using a separate taxonomy