Feature/cro 24 track time on version overlay#2
Open
MarcelBirkhahn wants to merge 4 commits intomainfrom
Open
Conversation
arissling
suggested changes
Apr 2, 2026
arissling
left a comment
There was a problem hiding this comment.
- The logic will not work. See my comments in the code
- Use pure function, please. This makes it easier to follow and to debug.
| } | ||
|
|
||
| function trackTimeOnShopOrTrialOverlay() { | ||
| const utils = optimizely.get("utils"); |
There was a problem hiding this comment.
Place this outside of the function, please.
| registeredButtons = []; | ||
| } | ||
|
|
||
| const OVERLAY_SELECTOR = |
There was a problem hiding this comment.
Place CONSTANTS outside of the function, please.
|
|
||
| const OVERLAY_SELECTOR = | ||
| ".ReactModal__Overlay--after-open .shop-or-trial-content"; | ||
| const BUTTON_SELECTOR = "button.smtg-button"; |
There was a problem hiding this comment.
Place CONSTANTS outside of the function, please.
| let hasSelected = false; | ||
|
|
||
| function onOverlayShown() { | ||
| if (startTime) return; |
There was a problem hiding this comment.
On initial load the logic will fail excatly because of this.
On initial load the start time is falsy (null) so the function return.
Then onButtonClick get's added to the event listeners.
When onButtonClick is called it returns directly on line 31 because startime is falsy.
Collaborator
Author
There was a problem hiding this comment.
Thanks! I deleted this line.
Collaborator
Author
|
@arissling I'm done with all changes. Please take a look again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Testing guide: