diff --git a/doc/development/internal_analytics/internal_event_instrumentation/event_definition_guide.md b/doc/development/internal_analytics/internal_event_instrumentation/event_definition_guide.md index 0d706b39e42c51b8f8132b3caf0c43a4be6b322b..24de9622aa8d3b4f05c5027f0610f600d19b5d32 100644 --- a/doc/development/internal_analytics/internal_event_instrumentation/event_definition_guide.md +++ b/doc/development/internal_analytics/internal_event_instrumentation/event_definition_guide.md @@ -34,6 +34,7 @@ Each event is defined in a separate YAML file consisting of the following fields | `introduced_by_url` | no | The URL to the merge request that introduced the event. | | `distributions` | yes | The [distributions](https://handbook.gitlab.com/handbook/marketing/brand-and-product-marketing/product-and-solution-marketing/tiers/#definitions) where the tracked feature is available. Can be set to one or more of `ce` or `ee`. | | `tiers` | yes | The [tiers](https://handbook.gitlab.com/handbook/marketing/brand-and-product-marketing/product-and-solution-marketing/tiers/) where the tracked feature is available. Can be set to one or more of `free`, `premium`, or `ultimate`. | +| `additional_properties` | no | A list of additional properties that are sent with the event. Each record must have `description` field. Built-in properties are: `label` (string), `property` (string) and `value` (numeric). [Custom](quick_start.md#additional-properties) properties can be added if the built-in options are not sufficient. | ### Example event definition diff --git a/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md b/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md index 319c629d147ead954a05cb3ab35a0e04a99d0de8..5b115315791501696413688f8bfb78598a1e5426 100644 --- a/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md +++ b/doc/development/internal_analytics/internal_event_instrumentation/quick_start.md @@ -76,7 +76,10 @@ track_internal_event( #### Additional properties -Additional properties can be passed when tracking events. They can be used to save additional data related to given event. It is possible to send a maximum of three additional properties with keys `label` (string), `property` (string) and `value`(numeric). +Additional properties can be passed when tracking events. They can be used to save additional data related to given event. + +Tracking classes have built-in properties with keys `label` (string), `property` (string) and `value`(numeric). It's recommended +to use these properties first. Additional properties are passed by including the `additional_properties` hash in the `#track_event` call: @@ -91,6 +94,26 @@ track_internal_event( ) ``` +If you need to pass more than three additional properties, you can use the `additional_properties` hash with your custom keys: + +```ruby +track_internal_event( + "code_suggestion_accepted", + user: user, + additional_properties: { + label: 'vsc', + property: 'automatic', + value: 200, + lang: 'ruby', + custom_key: 'custom_value' + } +) +``` + +Please add custom properties only in addition to the built-in properties. + +Custom rules can not be used as [metric filters](metric_definition_guide.md#filters). + #### Controller and API helpers There is a helper module `ProductAnalyticsTracking` for controllers you can use to track internal events for particular controller actions by calling `#track_internal_event`: