Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initialization error events #396

Merged
merged 7 commits into from
Jan 30, 2025

Conversation

gianfra-t
Copy link
Contributor

@gianfra-t gianfra-t commented Jan 21, 2025

Closes #391

Changes

  • Adds a new event InitializationErrorEvent.
  • Adds new logic such that each variant is only fired once. This state is saved on the local storage because the nature of this events imply the user will potentially refresh many times the page, or come back to it many times.
  • Refactors slightly how ready and initializeFailedMessage are set on the main component.
  • Also refactors fetchSigningServiceAccountId such that it distinguishes errors.
  • The state of fired initialization errors is cleared once the app starts correctly once. After that, any new error would trigger a new event.

Additional notes

The new tag initalization_error was added to tag manager and tested on the preview.

@gianfra-t gianfra-t linked an issue Jan 21, 2025 that may be closed by this pull request
Copy link

netlify bot commented Jan 21, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit a7a8b90
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/679bc499a0b15200081294d8
😎 Deploy Preview https://deploy-preview-396--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gianfra-t gianfra-t marked this pull request as ready for review January 22, 2025 18:55
@gianfra-t gianfra-t requested a review from a team January 22, 2025 18:55
if (!pendulumNode.apiComponents?.api && pendulumNode?.isFetched) {
setApiInitializeFailed(true);
trackEvent({ event: 'initialization_error', error_message: 'node_connection_issue' });
}
Copy link
Contributor Author

@gianfra-t gianfra-t Jan 22, 2025

Choose a reason for hiding this comment

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

As much as I would like to add this to the useEffect below that sets the signing service error, they depend on different queries and would trigger multiple times.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

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

Nice idea with persisting the events in localstorage to reduce the event count. However, I think we can simplify this. I assume that GA is smart enough to know that a user is still the same when they refresh the page because cookies are used to track that. So if the same user gets the same initialization error in the same session, it wouldn't matter for our analytics. That's why I think we can remove the extra logic with persisting in the local storage.

I also corrected the measurement ID and event name of the initialization_error tag in GTM. It should work now.

src/contexts/events.tsx Outdated Show resolved Hide resolved
src/contexts/events.tsx Outdated Show resolved Hide resolved
src/contexts/events.tsx Outdated Show resolved Hide resolved
src/hooks/offramp/useOfframpAdvancement.ts Show resolved Hide resolved
src/pages/swap/index.tsx Outdated Show resolved Hide resolved
@gianfra-t
Copy link
Contributor Author

@ebma I tested on tag manager (using the preview tab) the event at the time, and it was fired and registered. Just to know for next time, what was the issue there?

Regarding multiple firing, I think for some analysis we will have a harder time if we have these multiple events, for example for counting each or the share of each w.r.t. all errors, etc. Can we test if they are filtered automatically? I tried adding on GA the analysis, but realized that it would only work once this is in staging or production.

@ebma
Copy link
Member

ebma commented Jan 29, 2025

Regarding multiple firing, I think for some analysis we will have a harder time if we have these multiple events, for example for counting each or the share of each w.r.t. all errors, etc. Can we test if they are filtered automatically?

I'm not sure. Let's ask the others.

@ebma ebma merged commit 8d72665 into polygon-prototype-staging Jan 30, 2025
5 checks passed
@ebma ebma deleted the 391-add-value-to-form_error-event branch January 30, 2025 18:33
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.

Add value to form_error event
2 participants