Allow more than 3 additional properties in Internal Events For Frontend
What does this MR do and why?
There are many cases where it would be desirable to add additional properties to an event besides just the label
(string), property
(string) and value
(number)
This MR adds those properties.
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
We will test whether properties apart from label, value, property is allowed or not.
- Apply below patch
diff --git a/app/assets/javascripts/tracking/index.js b/app/assets/javascripts/tracking/index.js
index 2ee4703aa0b5..9e675c6b6d3c 100644
--- a/app/assets/javascripts/tracking/index.js
+++ b/app/assets/javascripts/tracking/index.js
@@ -73,4 +73,10 @@ export function initDefaultTrackers() {
InternalEvents.bindInternalEventDocument();
InternalEvents.trackInternalLoadEvents();
InternalEvents.initBrowserSDK();
+
+ InternalEvents.trackEvent('user_viewed_dashboard_list', {
+ label: 'value',
+ value: 2,
+ key: 'value',
+ });
}
- Install snowplow debugger in the browser.
- Refresh any page and verify
value
,label
andexta
are being passed.
We have also added data-event-custom
to pass custom properties via template method. To test that
- Apply below patch
diff --git a/app/assets/javascripts/super_sidebar/components/brand_logo.vue b/app/assets/javascripts/super_sidebar/components/brand_logo.vue
index 2a7b4ddd3497..c52edec4d191 100644
--- a/app/assets/javascripts/super_sidebar/components/brand_logo.vue
+++ b/app/assets/javascripts/super_sidebar/components/brand_logo.vue
@@ -29,9 +29,10 @@ export default {
v-gl-tooltip:super-sidebar.right="$options.i18n.homepage"
class="brand-logo"
:href="rootPath"
- data-track-action="click_link"
- data-track-label="gitlab_logo_link"
- data-track-property="nav_core_menu"
+ data-event-tracking="i_analytics_dev_ops_adoption"
+ data-event-label="gitlab_logo_link"
+ data-event-property="nav_core_menu"
+ data-event-custom='{"key1": "value1", "key2": "value2"}'
>
<span class="gl-sr-only">{{ $options.i18n.homepage }}</span>
<!-- eslint-disable @gitlab/vue-require-i18n-attribute-strings -->
- Open any page and click on gitlab logo on top-left corner.
- Check in the network tab that it calls snowplow and track_event API with additionalProperties of label and property.
Related to #465941 (closed)
Edited by Ankit Panchal