Skip to content

fix: properly detect analytics API success to prevent duplicate events#452

Open
henyaGreenberg wants to merge 1 commit into
mainfrom
fixDoubledPageViewEvent
Open

fix: properly detect analytics API success to prevent duplicate events#452
henyaGreenberg wants to merge 1 commit into
mainfrom
fixDoubledPageViewEvent

Conversation

@henyaGreenberg

Copy link
Copy Markdown
Contributor

The API returns {status: 200, message: 'success'} but the code was checking result.success which was undefined. This caused sentEvents.add() to never execute, breaking the duplicate prevention mechanism and allowing multiple page_view events with the same flowId to be sent to the database.

The API returns {status: 200, message: 'success'} but the code was checking result.success which was undefined. This caused sentEvents.add() to never execute, breaking the duplicate prevention mechanism and allowing multiple page_view events with the same flowId to be sent to the database.
Copilot AI review requested due to automatic review settings February 5, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a critical bug in the analytics event tracking system where duplicate prevention was not working. The issue was caused by checking a non-existent result.success property instead of properly validating the API response structure (status: 200, message: 'success'), which prevented the deduplication mechanism from recording sent events.

Changes:

  • Updated success detection logic to check the actual API response structure (result.status === 200 && result.message === 'success')

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

Comment thread iframe-frontend/src/context/googleAnalyticsContext.tsx

@kalfada kalfada left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see how it would solve the double event problem, but it wouldn't brake anything

@NoamMK NoamMK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see how it can help

@NoamMK

NoamMK commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@henyaGreenberg , unless you still think it's needed (then explain why) - please close this PR.

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.

4 participants