Skip to content

Allow Additional Internal event properties on Frontend

Ankit Panchal requested to merge 434505-pass-additional-props-fe into master

What does this MR do and why?

In this MR, allowing value, label and property to be passed to snowplow, track_event API and browserSDK for Frontend.

Similar Backend MR - !142839 (merged)

How to set up and validate locally

  1. Add below code in the last line of tracker/index.js, This will allow us to send track_event API call on any page in GDK.
InternalEvents.trackEvent('user_viewed_dashboard_list', undefined, {
    label: 'value',
    property: 'value',
    value: 2,
  });

Here is the patch

diff --git a/app/assets/javascripts/tracking/index.js b/app/assets/javascripts/tracking/index.js
index 2ee4703aa0b..058430338bc 100644
--- a/app/assets/javascripts/tracking/index.js
+++ b/app/assets/javascripts/tracking/index.js
@@ -73,4 +73,9 @@ export function initDefaultTrackers() {
   InternalEvents.bindInternalEventDocument();
   InternalEvents.trackInternalLoadEvents();
   InternalEvents.initBrowserSDK();
+  InternalEvents.trackEvent('user_viewed_dashboard_list', undefined, {
+    label: 'value',
+    property: 'value',
+    value: 2,
+  });
 }
  1. Install snowplow debugger in the browser.
  2. Refresh any page and verify value, label and property are being passed.

Screenshot_2024-03-04_at_5.36.01_PM

  1. Verify that it is passed as an object additional_properties in track_event API call

Screenshot_2024-03-05_at_12.21.40_PM

  1. If properties are other than value, label and property, it will throw an error.

Screenshot_2024-03-05_at_9.52.00_PM

Related to #434505 (closed)

Edited by Ankit Panchal

Merge request reports