GMAU: Track Design views in Usage Ping
About
We would like to track unique design views (unique per user) per month for self-hosted instances.
Problems
We need to work out the best way to do this. According to this chart the only flow of telemetry data from self-hosted to GitLab.com remains the UsageData
ping.
See https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392334638 for the original discussion thread that proposed some ideas:
- GraphQL recording when
DesignType#image
is resolved successfully (https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392345132 and https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392347288) - although when the frontend requests data for the "design collection" we may end up recording a view. - A new mutation to receive view event data from the front end https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392357923 which should try to limit the ability for abuse https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392366190
Proposal
-
Use the new Usage Data REST API as described in point 6 at https://docs.gitlab.com/ee/development/product_analytics/usage_ping.html#adding-new-events
Track events using JavaScript/Vue API helper which calls the API above Example usage for an existing event already defined in known events: Note that usage_data_api and usage_data_#{event_name} should be enabled in order to be able to track events
import api from '~/api'; api.trackRedisHllUserEvent('my_already_defined_event_name'),
-
Use
design_action
as event name, this is already used to track creates/updates/destroys in https://gitlab.com/gitlab-org/gitlab/blob/0a13f74441c2e61bbeefb2825e7ad611ddb28f0c/lib/gitlab/usage_data_counters/track_unique_events.rb#L7- All of these events are mapped to the same
design_action
key, so we'll only get the unique users across all actions, not for each action individually.
- All of these events are mapped to the same
-
Add a new feature flag YAML file with the name
usage_data_design_action
.- This can be default-enabled.
See also
- Original discussion: https://gitlab.com/gitlab-data/analytics/-/issues/4761#note_392202311