Skip to content

Create a list of Snowplow events emitted from the frontend

Spreadsheet with data

https://docs.google.com/spreadsheets/d/1CwChRvItO64e7OmDnUqLgOXjt61MUDGJcRtICGLo7-Q/edit

  • It has three tabs: "Vue", "HTML" (Vue + HAML), and "Raw JS".
  • "Vue" tab has two additional columns, "uses data" (TRUE if there is a tracking Vue property) and "uses directive" (TRUE if using the directive tracking wrapper); these two gives us insights about preferred usage.
  • "HTML" has an additional "HTML tag" column that holds the element that fires the event. This is important because this method dispatches the event on click, show.bs.dropdown or hide.bs.dropdown. With dropdowns, it fires the event when opening and closing, adding _show or _hide to the action string correspondingly. If the HTMLElement has a value property, it's used as the value for the event.
  • Fields that use variables are wrapped into square brackets ([variableName]).
  • Fields that have an optional value are prefixed with a ? (?[mightBeEmpty])
  • Fields that have values separated by pipes are ENUM-like fields (on | off | n/a)

Conclusions

  • All tracking calls are pointing to the Tracking class.
  • Usage is not wrong, but there are cases with some invalid trackStructEvent properties.
  • Events fired using Raw JS takes more liberties. The second place would be the Vue directive. Events fired using data-attributes and mixins seem to respect the taxonomy more.
  • A good topic for gitlab-com/www-gitlab-com#10480 (closed) would be "How to fix invalid event payloads", and some of the questions to answer might be (we should clarify this to the docs as well):
    • What is the naming convention for action?
    • Is category a namespace?
    • Is label the name of property?
    • Is property the name of value?
    • What can value hold?

Methods used for tracking

FROM METHOD METHOD DEFINITION EXAMPLE
Vue mixin app/assets/javascripts/tracking.js#L141 app/assets/javascripts/authentication/two_factor_auth/components/recovery_codes.vue#L82
Vue data-attributes app/assets/javascripts/tracking.js#L117 app/assets/javascripts/blob/pipeline_tour_success_modal.vue#L125
Vue directive app/assets/javascripts/vue_shared/directives/track_event.js app/assets/javascripts/monitoring/components/dashboard_actions_menu.vue#L185
HAML data-attributes app/assets/javascripts/tracking.js#L117 app/views/groups/new.html.haml#L26
HAML data-attributes (literal) app/assets/javascripts/tracking.js#L117 app/views/shared/issuable/_sidebar_assignees.html.haml#L59
HAML helper app/helpers/tracking_helper.rb app/views/layouts/header/_default.html.haml#L11
Raw JS class app/assets/javascripts/tracking.js#L106 app/assets/javascripts/design_management/utils/tracking.js#L32
Edited by Axel García