fix(web): track consented cross-device signups - #459
Open
shehjad-dev wants to merge 2 commits into
Open
shehjad-dev wants to merge 2 commits into
shehjad-dev wants to merge 2 commits into
Conversation
shehjad-dev
force-pushed
the
codex/web-signup-conversion
branch
from
September 11, 2026 08:24
69dab63 to
7d2cacb
Compare
shehjad-dev
force-pushed
the
codex/web-signup-conversion
branch
from
September 11, 2026 16:01
7d2cacb to
2c47cfa
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.
Why
Most clicks in the current YouTube campaign happen on mobile, while treg is mainly used on desktop. The existing server-side conversion path depends on a Google click ID reaching the browser where the team is created, so it cannot cover every mobile-click → desktop-signup journey.
Google Ads already has a separate website conversion action,
treg Signup (web), but treg was not firing it. This PR wires up that action while keeping optional Google Ads measurement behind a clear browser choice.What changed
treg_ad.gclid,gbraid, orwbraid) is captured only when one is present.treg Signup (web)only when that browser has already accepted optional cookies.treg-web-signup-<org_id>as its transaction ID so a browser retry cannot count the same event twice inside that conversion action.signup,first_call, andpaidoutbox. New rows are now eligible on the next worker run instead of waiting six hours; retry and dead-letter behavior is unchanged.Who sees the banner
The current implementation is global rather than location-based. It is the simplest and safest starting point: any browser with no saved choice sees the banner on treg's public website/landing pages and signed-in dashboard, whether the visitor came from an ad or arrived organically.
The shared legal/information shell also shows it on Privacy, Terms, Support, and the Claude connector information page. The choice is stored for that browser and is not cleared by logout. Clearing browser data or using a fresh/private browser causes the banner to appear again.
Machine-to-machine surfaces do not show a banner: MCP v2, Codex/plugin calls, Grok plugin calls, terminal/CLI API traffic, and other JSON/MCP requests have no webpage. The CLI login page, treg MCP authorization page, and short provider OAuth callback result pages also do not show it because they load no Google measurement. If those flows return to the dashboard, the dashboard shows the banner when the browser has no saved choice.
The Facebook, Instagram, Google, and other provider authorization pages belong to those providers; treg cannot display its banner on their domains.
Result of each choice
treg_adclick cookie is created.Location-based visibility later
The banner can become geo-aware later by adding a trusted country signal or a proper consent platform to the central consent module. At that point the team must choose the default outside regulated regions and update the privacy text and tests. The ad-click capture, signup event, and server uploader can continue using the same central consent state.
Google Ads configuration
Keep
treg Signup (web)Secondary while it is being verified. It is separate from the server-sidetreg Signupaction, so Google will not automatically deduplicate an event that reaches both actions. This PR does not close or modify #332.Verification completed
git diff --check: clean.After merge and deployment
treg Signup (web)Secondary.Synthetic tests can prove the browser and server wiring, but only a real ad click can prove final attribution inside Google Ads.