Skip to content

Add search query as an attribute on result links

Sarah German requested to merge gps-ga-query into main

What does this MR do and why?

Adds a data attribute containing the search query on result links on the search-as-you-type style forms.

This will enable us to better track search queries in Google Analytics: https://gitlab.com/gitlab-com/marketing/marketing-strategy-performance/-/issues/1273#note_1422515172

Relates to #1333 (closed)

How to validate

Use the review app here: https://gps-ga-query.docs.gitlab-review.app/

  1. Type a search query in the search form on the homepage or an interior content page
  2. Inspect HTML source in dev tools and verify the query is shown in each result link like this: data-search-query="myquery"

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports