Skip to content

feat(umami): send visitor IP and declared event params as event data - #165

Merged
franklinkim merged 2 commits into
foomo:mainfrom
airtime-sw-ag:feature/umami-ip-and-data
Oct 30, 2026
Merged

franklinkim merged 2 commits into
foomo:mainfrom
airtime-sw-ag:feature/umami-ip-and-data

Conversation

@loeffert

@loeffert loeffert commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Problem

The server-side Umami tag sends requests to /api/send from the GTM server container. It has two gaps:

  • It sends no payload.ip. Umami uses the IP of the GTM server for the session hash, the IP block list and the location lookup. Different visitors with the same user agent can share one session.
  • It sends no payload.data. The event parameters that the event types declare do not reach Umami, so Umami cannot show event properties.

Change

  • The template sends the first address of ip_override as payload.ip. It trims the value and ignores the rest of a comma-separated list.
  • The tag gets a new eventParameters parameter (SIMPLE_TABLE, one name column). Server fills it with the param names that utils.LoadEventParams returns for the event type (the JSON names of the Params fields), sorted.
  • The template reads only these keys from the event data and sends them as payload.data. It omits undefined, null and "" values. It keeps 0 and false. No other event data goes to Umami.
  • tag.NewUmami gets a new params map[string]string argument before triggers.
  • docs/providers/umami.md describes the event data and the visitor IP.

read_event_data already allows any key, so the permissions do not change.

Compatibility

  • Events without declared params send no data, as before.
  • payload.ip requires Umami v2.10.0 or later. Earlier versions do not read it.
  • Umami v2.17.0 and later skip the location headers (cf-ipcountry, cf-ipcity, ...) when payload.ip is set. They resolve the location from the IP with the GeoIP database. Instances without that database lose the location data from the Cloudflare headers.
  • Umami v2.17.0 and later validate payload.ip (z.string().ip() in 2.x). An invalid ip_override value causes a 400 response.
  • tag.NewUmami has a new argument. This breaks external callers of the exported function.
  • Sites that use a custom tag template (templates.tag) keep their template. The tag sends the new eventParameters parameter, and their template ignores it.

How tested

  • New unit tests: pkg/provider/umami/server/tag/umami_test.go (list parameter, sort order, no parameter without params) and pkg/provider/umami/server/template/umami_test.go (template parameters and permissions parse as JSON, the JS sets ip and data).
  • A local Node harness ran the sandboxed JS with mocked GTM APIs: ip_override: " 1.2.3.4 , 10.0.0.1" gives ip: "1.2.3.4"; declared params give data: {"currency":"EUR","value":0} without user_id and empty values; no declared params give no data.
  • make test: pass. golangci-lint run ./pkg/provider/umami/...: 0 issues. The full make lint reports one issue that already exists on main (wsl_v5 in pkg/provider/openaiads/server/tag/conversion.go:18).
  • Also tested in a live GTM server container and against a live Umami instance.

🤖 Generated with Claude Code

loeffert and others added 2 commits October 27, 2026 10:40
The Umami server tag now sends the first ip_override address as payload.ip
and the event type's declared Params as payload.data. Events without
declared params send no data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@franklinkim
franklinkim merged commit cddb6e4 into foomo:main Oct 30, 2026
1 check 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.

2 participants