Suppress client Amplitude for server-side emitted events#2113
Merged
Conversation
…r-side These five events are now emitted server-side via the backend Amplitude Node SDK. Add a per-call `amplitude` option to track() and set it to false at the matching client call sites so Amplitude no longer double-counts them. Firebase + GTM still fire, so web conversion / ad attribution is preserved. - Account Created: SIGNUP_COMPLETED (signup/creating). - Savings Deposit: DEPOSIT_COMPLETED in the 5 backend-routed deposit hooks (EOA USDC/Fuse/ETH, Solid USDC/ETH). Client-only deposits (useDeposit, useDepositFromSolidFuse) and the add-funds-to-wallet step (useTransferToWallet) keep firing Amplitude — the backend does not track those paths. - Card Deposit: CARD_DEPOSIT_COMPLETED (useCardDepositPoller fallback). - Card Borrow: BRIDGE_TO_ARBITRUM_COMPLETED in useBorrowAndDepositToCard only (the generic bridge/swap-to-card hooks are not borrows and keep firing Amplitude). trackIdentity calls are kept (they set the Amplitude user id/properties). https://claude.ai/code/session_011g7dN8ScZ3Yr4U6fhYEsq5
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
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.
Summary
This PR prevents double-counting of analytics events by suppressing client-side Amplitude tracking for events that are now emitted server-side by the backend. Firebase and GTM continue to fire to preserve web conversion and ad attribution.
Key Changes
TrackOptionstype tolib/analytics.tswith anamplitudeboolean flag (defaults totrue)track()function to accept an optionaloptionsparameter and conditionally calltrackAmplitudeEvent()based on theamplitudeflag{ amplitude: false }) for the following events that are now emitted server-side:DEPOSIT_COMPLETEDinuseDepositFromEOAEth.ts,useDepositFromEOAFuse.ts,useDepositFromEOA.ts,useDepositFromSolidUsdc.ts, anduseDepositFromSolidEth.tsSIGNUP_COMPLETEDinapp/signup/creating.tsxBRIDGE_TO_ARBITRUM_COMPLETEDinuseBorrowAndDepositToCard.tsandCARD_DEPOSIT_COMPLETEDinuseCardDepositPoller.tsImplementation Details
track()without the options parameter continue to send to Amplitude by defaulthttps://claude.ai/code/session_011g7dN8ScZ3Yr4U6fhYEsq5