Skip to content

Allow more than 3 additional properties in Internal Events For Frontend

Problem

Ref Issue - #462378 (closed)

We need a way to allow more than 3 properties to internal events in frontend.

Desired Outcome

  • We should be able to pass more than 3 additional properties in Vue, Raw JS and HAML template.

Proposed Solution

Method signature proposal:

trackEvent(
  "code_suggestion_requested",
  additional_properties: {
    label: suggestion_id,
    property: suggestion_model,
    value: token_amount,
    lang: suggestion_lang
  }
)
  • Add a validation that first label and property should be filled before adding any custom property.
  • filter out custom properties from additional Properties object.
  • Pass it to standard context's extra.
  • Remove the validation of allowing only label,property and value, so we can pass custom properties to track_event API call.
  • Pass custom properties to Product Analytics as well.
  • Provide custom attribute to pass additional properties in the template. It can be something like this
<div data-track-custom='{"key1": "value1", "key2": "value2"}'></div>

How to verify

Migrated event is showing up with the custom properties in the production data.