Skip to content

feat: add analytic calls to upload button#1400

Merged
DNR500 merged 1 commit intomainfrom
1247-analytics-call-on-upload-button
Mar 24, 2026
Merged

feat: add analytic calls to upload button#1400
DNR500 merged 1 commit intomainfrom
1247-analytics-call-on-upload-button

Conversation

@DNR500
Copy link
Contributor

@DNR500 DNR500 commented Mar 23, 2026

Issue: 1247

Adds analytics calls to Upload button

Copilot AI review requested due to automatic review settings March 23, 2026 11:48
Copy link
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

Adds Plausible analytics instrumentation for the Scratch project “Upload” flow to support issue #1247.

Changes:

  • Track an analytics event when the Upload button is clicked.
  • Track an analytics event when a .sb3 file is selected (Scratch projects only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 19 to +32
const onClickUpload = () => {
if (window.plausible) {
window.plausible("Upload project");
}
fileInputRef.current?.click();
};

const onFileSelected = (event) => {
const file = event.target.files?.[0];
if (!file || project.project_type !== "code_editor_scratch") return;

if (window.plausible) {
window.plausible("Upload project - file selected");
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

New analytics side effects (Plausible events on click and on file selection) are not covered by existing UploadButton tests. Please extend UploadButton.test.js to assert window.plausible is called with the expected event names for both interactions (and reset the mock between tests).

Copilot uses AI. Check for mistakes.
@DNR500 DNR500 merged commit 0dd1a07 into main Mar 24, 2026
11 checks passed
@DNR500 DNR500 deleted the 1247-analytics-call-on-upload-button branch March 24, 2026 14:08
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