Skip to content

GitLab Version - Badge Tracking

Zack Cuddy requested to merge 369442-version-badge-analytics into master

What does this MR do and why?

Closes #369442 (closed)

This change adds snowplow tracking to the Version Check Badge. The intention is to track the following events:

  1. Badge Rendered
    • Where it was rendered (admin, help, help dropdown)
    • Badge Variant (Up to date, Upgrade available, Update ASAP)
  2. Badge Clicked
    • Where it was clicked at (admin, help, help dropdown)
    • Badge Variant (Up to date, Upgrade available, Update ASAP)

From what I understand Snowplow always provides page level information in its events so tracking Where should come out of the box. The variant is stored in the this.status property which is passed to the tracking event.

Important I was unable to successfully setup snowplow on my GDK and am fully relying on the jest specs to validate that it works. This was the strategy provided by this Slack Thread (internal only).

Screenshots or screen recordings

Change only adds tracking so there isn't any visual changes.

How to set up and validate locally

Important

  1. Ensure Gitlab::CurrentSettings.version_check_enabled is set to true (it defaults to true)
  2. Version Check uses ReactiveCache so the first time you navigate to a place where the badge should be, it may not be in the cache and required a single reload.
  3. Please read note above in the first section about my issues with setting up snowplow locally.

Testing Instructions

  1. Repeat these steps for the following views
    • /help
    • /admin
    • Help Dropdown (? in top nav)
  2. Find the Version Check badge
    • /help => At top of page
    • /admin => In the components card
    • Help Dropdown => First list item
  3. Ensure that when the badge is rendered the correct tracking event is fired
  4. Ensure when clicking the badge the correct tracking event is fired

MR acceptance checklist

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

Related to #369442 (closed)

Merge request reports