Skip to content

Track conversions and direct-mail Toronto visits - #107

Merged
xrendan merged 2 commits into
mainfrom
codex/track-conversions-and-filter-extension-errors
Sep 28, 2026
Merged

xrendan merged 2 commits into
mainfrom
codex/track-conversions-and-filter-extension-errors

Conversation

@xrendan

@xrendan xrendan commented Sep 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Report newsletter signups and voter pledges to PostHog and Google Ads, and initialize the Google Ads tag so conversion events have a configured destination.
  • Filter the known browser-extension runtime.sendMessage() exception from PostHog only when its stack originates from an extension.
  • Redirect /voteTO (including the trailing-slash form) to https://www.buildcanada.com/toronto/vote/2026/ with every supplied query value preserved. Add missing utm_source=direct_mail, utm_medium=offline, and utm_campaign=voteTO so PostHog can attribute untagged direct-mail visits; supplied UTM values take precedence.

Verification

  • pnpm build passed.
  • pnpm exec tsc --noEmit passed after the build generated Next.js types.
  • ESLint passed on all changed files; git diff --check passed.
  • Focused checks passed for conversion destinations, PostHog exception filtering, and redirect query preservation.
  • Tested the built app over HTTP: /voteTO and /voteTO/ return 307 with the expected location; repeated/custom query parameters and supplied UTM values are preserved.

Repository-wide pnpm lint still fails on existing CSS token matches in src/components/ui/select.tsx and src/components/elections/SurveyGrid.tsx (with four unrelated ESLint warnings).

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Adds Google Ads conversion tracking to signup and voter pledge flows.

The PR appears safe to merge; no outstanding finding or new actionable issue was identified.

Summary

The PR adds Google Ads and PostHog conversion reporting, filters a known extension-originated exception, and redirects /voteTO while preserving query values and filling in missing campaign tags.

  • Since the previous review, it moves tag initialization earlier, queues conversions, restricts Ads tracking to production hosts, and updates the README.
  • Greptile automatically discovered a related ticket that helped explain the purpose of this PR: tracking Toronto election pledges and member interactions.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["/voteTO request"] --> B["Preserve query; add missing UTMs"]
  B --> C["Toronto vote page"]
  D["Successful signup or pledge"] --> E["PostHog event"]
  D --> F{"Production host?"}
  F -- Yes --> G["Queue Google Ads conversion"]
  F -- No --> H["Skip Ads conversion"]
Loading

Reviews (2) · Last reviewed commit: "Queue early Ads conversions and restrict..."

Comment thread src/lib/conversions.ts Outdated
Comment thread src/app/layout.tsx Outdated
Comment thread src/app/layout.tsx Outdated
@xrendan
xrendan merged commit 234b545 into main Sep 28, 2026
2 checks passed
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.

1 participant