Skip to content

Add extra attributes to Internal events tracking on frontend

Ankit Panchal requested to merge 423946-add-data-internalEvents into master

What does this MR do and why?

Current implementation of Internal Events, only accepts event(action) as an argument. In case user wants to pass any other information to snowplow with extra attribute or wants to pass additional context, it is not possible in the current set up.

This MR adds data argument in track_event which will be used for adding context and extra params.

Implements #423946 (closed)

How to set up and validate locally

Currently, this is not being used anywhere in the code. we have follow up on !130484 (comment 1538708156) where I will be adding that.

Just to test if it is working properly follow below test (This requires ultimate license in gdk):

  1. Open ee/app/assets/javascripts/analytics/devops_reports/devops_adoption/components/devops_adoption_app.vue file.
  2. Update below line
 this.track_event(this.$options.trackDevopsTabClickEvent);

to

 this.track_event(this.$options.trackDevopsTabClickEvent, {
    extra: {key : 'value'},
    context: {
      schema: 'iglu:com.gitlab/design_management_context/jsonschema/1-0-0',
      data: {
        'design-version-number': '1.0.0',
        'design-is-current-version': '1.0.0',
        'internal-object-referrer': 'https://gitlab.com',
        'design-collection-owner': 'GitLab',
      },
    },
  });
  1. In GDK go to http://127.0.0.1:3000/admin/dev_ops_reports
  2. Add debugger on dispatch_snowplow_event.js file, Click on the dev tab.
  3. Verify that three contexts are present and in the gitlab_standard context's extra field key : value is present

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #423946 (closed)

Edited by Ankit Panchal

Merge request reports