Skip to content

Expose setting category on Internal Events for migration purposes (FE)

Ankit Panchal requested to merge 435204-expose-category-internal-events into master

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

  1. 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');
 }
  1. Reload any page, verify that on snowplow API call se_ca is set as a 'newCategory'

Screenshot_2024-01-18_at_12.57.36_PM

  1. Alternatively, verify with snowplow chrome extension

Screenshot_2024-01-18_at_12.58.48_PM

  1. 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

image

Related to #435204 (closed)

Edited by Ankit Panchal

Merge request reports