fix: route Request Created to Customer.io via identified profile to stop email-less profiles [INS-2678]#10019
Open
pavkout wants to merge 3 commits into
Open
fix: route Request Created to Customer.io via identified profile to stop email-less profiles [INS-2678]#10019pavkout wants to merge 3 commits into
pavkout wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Routes the Request Created analytics event to Customer.io via the browser SDK’s already-identified (email-bearing) profile, to prevent creation of anonymous/email-less Customer.io profiles while keeping Segment tracking for warehouse/other destinations.
Changes:
- Added
trackCioEvent()helper inuse-cio.tsxto send Customer.io events only when a user is identified. - Updated Customer.io identification lifecycle to record/reset the identified user ID and reset on logout.
- Updated both
Request CreatedclientAction call sites to emit the event to Customer.io directly alongside existing Segment tracking.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/insomnia/src/ui/hooks/use-cio.tsx | Adds trackCioEvent and tracks/reset identified user state for Customer.io SDK usage. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.new.tsx | Sends Request Created to Customer.io directly (in addition to Segment) with shared properties object. |
| packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.debug.request.new.tsx | Sends Request Created to Customer.io directly (in addition to Segment) with shared metrics properties object. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7bb0d2c to
c237906
Compare
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.
Problem
The
Request Createdevent was wired through Segment → Customer.io as a destination.This created several thousand Customer.io profiles in a few hours, the vast majority
without an email. We pay per profile in Customer.io, so this is costly garbage.
Root cause
The app has two separate analytics pipelines keyed by different identifiers:
main/analytics.ts): only ever callstrack()/page()— neveridentify(). ItsuserIdis a SHA-256 hash of the account ID and itsanonymousIdis the device ID. It also fires for not-logged-in users(the gate is
enableAnalytics || hashedAccountId, andenableAnalyticsdefaults to
true).use-cio.tsx): the only place an email reachesCustomer.io, via
identify(accountId, { email, ... }), keyed by the rawaccountId, and only for logged-in users.So when Segment forwarded
Request Createdto Customer.io:reconciles with the raw-
accountIdemail profile.Fix
Stop relying on the Segment → Customer.io destination and emit
Request Createdthrough the Customer.io browser SDK directly, tied to the already-identified,
email-bearing profile:
trackCioEvent()helper inuse-cio.tsxthat reuses theexisting global SDK singleton. It no-ops unless a user is identified, so it
can never create anonymous, email-less profiles.
identifiedUserIdonidentify(), andreset()it on logout so eventsaren't misattributed to a previous account on shared machines / account switches.
Request Createdcall sites now send to Customer.io directly alongside theexisting Segment
track()(Segment still feeds the warehouse/other destinations).Follow-ups (outside this repo)
Request Createdin the Segment dashboard.