Skip to content

feat: add captureGeo opt-in for region/city/lat/lng/timezone#11

Merged
Gdewilde merged 1 commit intomainfrom
feat/capture-geo
Apr 26, 2026
Merged

feat: add captureGeo opt-in for region/city/lat/lng/timezone#11
Gdewilde merged 1 commit intomainfrom
feat/capture-geo

Conversation

@Gdewilde
Copy link
Copy Markdown
Contributor

Summary

  • Adds a `captureGeo` opt-in to `trackVisit`. When enabled, attaches `region`, `city`, `latitude`, `longitude`, and `timezone` derived from Vercel's `x-vercel-ip-*` edge headers.
  • City and region are URL-decoded (Vercel encodes them, e.g. `San%20Francisco`). Missing headers are omitted rather than emitted as empty strings.
  • Off by default — city-resolution geo is more identifying than the country-only `captureCountry` flag, so opt in deliberately.
  • Bumps version to 0.9.0.

This pulls the `geoProperties` helper out of apideck-io/developer-docs#798 and into the library so other Vercel-hosted consumers don't have to reinvent it. Once this lands, that PR can drop the helper and just set `captureGeo: true`.

Test plan

  • `npm run typecheck && npm test` — 110 tests pass, including 3 new ones covering decode, missing-header omission, and the off-by-default behavior.
  • After merge, confirm auto-release + auto-publish flow (fixed in fix(ci): explicitly dispatch publish.yml after creating release #10) ships 0.9.0 to npm without manual intervention.
  • Update apideck-io/developer-docs#798 to drop the local `geoProperties` helper and set `captureGeo: true` on the `trackVisit` call.

🤖 Generated with Claude Code

Adds a `captureGeo` flag that, when enabled, attaches `region`, `city`,
`latitude`, `longitude`, and `timezone` derived from Vercel's `x-vercel-ip-*`
edge headers. City and region are URL-decoded (Vercel encodes them, e.g.
`San%20Francisco`). Missing headers are omitted rather than emitted as empty
strings.

Off by default — city-resolution geo is more identifying than the
country-only `captureCountry` flag, so opt in deliberately.

This pulls a `geoProperties` helper out of apideck-io/developer-docs and
into the library so other Vercel-hosted consumers don't have to reinvent it.

Bumps to 0.9.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Gdewilde Gdewilde merged commit f786ef7 into main Apr 26, 2026
3 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