Expose setting category on Internal Events for migration purposes (FE)
What does this MR do and why?
The trackEvent
method currently has only one parameter: event
or action
. In this MR, I will add a category
parameter to facilitate the migration of existing events that rely on the main Snowplow tracking (Tracking.track
).
By default, if not provided, the category
value is document.body.dataset.page
. Overriding this value is discouraged, and this change is intended solely for migrating existing events that are already using the category
field.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Add below code of
trackEvent
after https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/tracking/index.js?ref_type=heads#L75
--- a/app/assets/javascripts/tracking/index.js
+++ b/app/assets/javascripts/tracking/index.js
@@ -73,4 +73,5 @@ export function initDefaultTrackers() {
InternalEvents.bindInternalEventDocument();
InternalEvents.trackInternalLoadEvents();
InternalEvents.initBrowserSDK();
+ InternalEvents.trackEvent('i_analytics_dev_ops_adoption', 'newCategory');
}
- Reload any page, verify that on snowplow API call
se_ca
is set as a 'newCategory'
- Alternatively, verify with snowplow chrome extension
- You can also verify that with Internal event monitor with below command in the terminal.
bundle exec rails runner scripts/internal_events/monitor.rb i_analytics_dev_ops_adoption
Related to #435204 (closed)
Edited by Ankit Panchal