Skip to content

Add properties to Funnel#2982

Merged
lmuntaner merged 2 commits intomainfrom
lm-add-property-funnel
Apr 2, 2025
Merged

Add properties to Funnel#2982
lmuntaner merged 2 commits intomainfrom
lm-add-property-funnel

Conversation

@lmuntaner
Copy link
Copy Markdown
Contributor

@lmuntaner lmuntaner commented Apr 2, 2025

Motivation

Properties need to be set in all the events in order to be able filter Funnels by them.

For example, to check the Funnel of NNS Dapp logins, we need to always set the origin of NNS Dapp in all the events triggered in that Funnel.

Changes

This pull request includes enhancements to the Funnel class and its associated tests to support the inclusion of properties in analytics events. The changes ensure that properties can be passed during initialization and triggering of events, and that these properties are correctly merged and tracked.

Enhancements to Funnel class:

Enhancements to Funnel tests:


🟡 Some screens were changed

@lmuntaner lmuntaner requested a review from Copilot April 2, 2025 09:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Funnel class to support passing properties for analytics events, allowing events to include additional context data such as the userId and source.

  • Modified the Funnel class to accept and forward optional properties in the init and trigger methods, and to include these properties in the close event.
  • Updated the Funnel tests to verify that events are correctly sent with or without properties, and that property merging works as expected.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/frontend/src/utils/analytics/Funnel.ts Enhanced the Funnel class to support optional properties with analytics events by adding parameters and merging properties where appropriate.
src/frontend/src/utils/analytics/Funnel.test.ts Extended tests to cover the new behavior of passing and merging properties in init, trigger, and close methods.
Comments suppressed due to low confidence (1)

src/frontend/src/utils/analytics/Funnel.ts:55

  • [nitpick] Consider resetting the stored properties (this.#properties) to undefined at the end of the close() method after triggering the final analytics event to ensure the funnel state is fully reset and to avoid potential unintended reuse of stale properties.
this.#startTimestamp = undefined;

@lmuntaner lmuntaner marked this pull request as ready for review April 2, 2025 09:22
@lmuntaner lmuntaner requested review from LXIF and sea-snake April 2, 2025 09:22
@lmuntaner lmuntaner mentioned this pull request Apr 2, 2025
@lmuntaner lmuntaner added this pull request to the merge queue Apr 2, 2025
Merged via the queue into main with commit 34a0db0 Apr 2, 2025
72 checks passed
@lmuntaner lmuntaner deleted the lm-add-property-funnel branch April 2, 2025 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants