Skip to content

feat: GA4 Measurement Protocol server destination - #765

Open
laurentdav wants to merge 2 commits into
elbwalker:mainfrom
laurentdav:feat/destination-ga4-mp
Open

laurentdav wants to merge 2 commits into
elbwalker:mainfrom
laurentdav:feat/destination-ga4-mp

Conversation

@laurentdav

Copy link
Copy Markdown

Closes #764.

What

New package @walkeros/server-destination-ga4 for the GA4 Measurement Protocol, laid out like the other HTTP destinations:

  • POST <url>?measurement_id=…&api_secret=… (default https://www.google-analytics.com/mp/collect; url for EU collection or /debug/mp/collect).
  • Rule name is the GA4 event name, space → _; an invalid name fails with mapping before any request.
  • Mapped data: client_id (<random>.<seconds> from _ga), session_id (sent in params), user_id, params (value coerced to a number). Without a valid client id, a stable one is derived from the event id so retries keep it. engagement_time_msec: 1 added.
  • consent.ad_user_data / ad_personalization: GRANTED only with the event's marketing consent.
  • timestamp_micros only for events under 71 hours (GA4 refuses older ones).
  • Settings: measurementId (validated G-…), apiSecret, url.

Also: docs page (links the gtag web destination for browser events), sidebar entry, server column of the GA4 row in the destinations index, website dependency, changeset (minor).

Verify

npm run verify:touched -- server-destination-ga4: typecheck, lint, conformance, 3 step examples + silent rule, 12 unit tests. walkerOS.json builds.

We run a vendored version of this destination on our own walkerOS server flow; this PR is that code ported to the monorepo conventions (the default endpoint is the global one here, ours is region1).

🤖 Generated with Claude Code

Closes elbwalker#764

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5e11064-a23e-4319-82f6-46379a56b512
Commits

Reviewing files that changed from the base of the PR and between dedbdf7 and d17a077.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 26

  • .changeset/ga4-server-destination.md
  • packages/server/destinations/ga4/README.md
  • packages/server/destinations/ga4/jest.config.mjs
  • packages/server/destinations/ga4/package.json
  • packages/server/destinations/ga4/src/__tests__/conformance.test.ts
  • packages/server/destinations/ga4/src/__tests__/index.test.ts
  • packages/server/destinations/ga4/src/__tests__/stepExamples.test.ts
  • packages/server/destinations/ga4/src/config.ts
  • packages/server/destinations/ga4/src/dev.ts
  • packages/server/destinations/ga4/src/examples/env.ts
  • packages/server/destinations/ga4/src/examples/index.ts
  • packages/server/destinations/ga4/src/examples/minimal.ts
  • packages/server/destinations/ga4/src/examples/step.ts
  • packages/server/destinations/ga4/src/index.ts
  • packages/server/destinations/ga4/src/push.ts
  • packages/server/destinations/ga4/src/schemas/index.ts
  • packages/server/destinations/ga4/src/schemas/mapping.ts
  • packages/server/destinations/ga4/src/schemas/primitives.ts
  • packages/server/destinations/ga4/src/schemas/settings.ts
  • packages/server/destinations/ga4/src/types/index.ts
  • packages/server/destinations/ga4/tsconfig.json
  • packages/server/destinations/ga4/tsup.config.ts
  • website/docs/destinations/index.mdx
  • website/docs/destinations/server/ga4.mdx
  • website/package.json
  • website/sidebars.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Same finding as on the sibling OpenAI Ads PR: a failed request goes to the
dead-letter queue; 429 and 5xx are only marked retryable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

New server destination: GA4 Measurement Protocol

1 participant