Skip to content

Feature/cro 24 track time on version overlay#2

Open
MarcelBirkhahn wants to merge 4 commits intomainfrom
feature/CRO-24-track-time-on-version-overlay
Open

Feature/cro 24 track time on version overlay#2
MarcelBirkhahn wants to merge 4 commits intomainfrom
feature/CRO-24-track-time-on-version-overlay

Conversation

@MarcelBirkhahn
Copy link
Copy Markdown
Collaborator

Testing guide:

  1. Open https://www.steinberg.net/cubase/
  2. Open browser console
  3. Paste tracking script into console and hit enter
  4. Click on "Buy Cubase 15" button on hero
  5. Click one of the "Buy ..." buttons in the shop-or-trial overlay
  6. See console logs

@MarcelBirkhahn MarcelBirkhahn requested a review from arissling April 2, 2026 07:49
Copy link
Copy Markdown

@arissling arissling left a comment

Choose a reason for hiding this comment

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

  1. The logic will not work. See my comments in the code
  2. Use pure function, please. This makes it easier to follow and to debug.

}

function trackTimeOnShopOrTrialOverlay() {
const utils = optimizely.get("utils");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Place this outside of the function, please.

registeredButtons = [];
}

const OVERLAY_SELECTOR =
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Place CONSTANTS outside of the function, please.


const OVERLAY_SELECTOR =
".ReactModal__Overlay--after-open .shop-or-trial-content";
const BUTTON_SELECTOR = "button.smtg-button";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Place CONSTANTS outside of the function, please.

let hasSelected = false;

function onOverlayShown() {
if (startTime) return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! I deleted this line.

@MarcelBirkhahn
Copy link
Copy Markdown
Collaborator Author

@arissling I'm done with all changes. Please take a look again.

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.

2 participants