Add snowplow tracking to audit events date range segmented control

Proposal

To help groupcompliance determine how often the audit events date range segmented control is used we should add snowplow to these buttons and wait for one milestone to collect some data on usage.

This data could then be used to influence UX questions and decisions around whether to keep them or what might be done to improve their usage.

The recommended data to send to snowplow is as follows:

Attribute Value Reasoning
category document.body.dataset.page Using this value will allow us to see which audit event page (admin, group, project) the event happened on
action click_date_range_button Follows the convention and describes the generic action taking place
label `date_range_button_[last_7_days last_14_days

value is probably not needed. We don't need to know the range set by the button and although knowing the full search params would be useful it definitely feels like we'd be collecting excessive data.

We should use the tracking data attributes variant so we automatically support disabling tracking automatically

Implementation

frontend 1️⃣

  1. Add tracking data attributes to ee/app/assets/javascripts/audit_events/components/date_range_buttons.vue using the snake cased title for the label attribute
  2. Add a test to check the attributes are applied to the buttons
  3. Add to the event dictionary

Follow-up

Add issue to review snowplow in one milestones time after implementation

Edited by Robert Hunt