Skip to content

FE - Dispatch Snowplow events from their event definitions

What does this MR do and why?

Related to #356621 (closed) and part of &7759 (closed). To be able to link an event with its definition (more wins).

Adds a .definition method to Tracking, with the following signature:

/**
 * @param  {String} basename
 * @param  {Object} eventData 
 * @returns {undefined|Boolean}
 */
static definition(basename, eventData = {})

After preloading the to-be-used definitions (will be addressed at #358256 (closed)). This method:

  • Finds the definition by the provided filename in the manifest.
  • Sets category and action from the definition. Overwritable by the method parameters.
  • Passes the data as parameters for the .event method.
Manifest example
Tracking.definitionsManifest = {
    // basename/key: file path
    '202108302307_default_click_button': 'config/events/202108302307_default_click_button.yml',
}

This new method doesn't change any feature and it's part of the first iteration for this proposal.

Screenshots or screen recordings

No visual changes.

How to set up and validate locally

No validation required for this MR. Specs should be green.

MR acceptance checklist

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

Edited by Axel García

Merge request reports