Skip to content

feat(frontend): set up Umami for events data collection#651

Merged
DarianM merged 23 commits intomainfrom
analytics
Apr 14, 2026
Merged

feat(frontend): set up Umami for events data collection#651
DarianM merged 23 commits intomainfrom
analytics

Conversation

@DarianM
Copy link
Copy Markdown
Member

@DarianM DarianM commented Apr 2, 2026

Summary

Closes #624

  • Adds Umami as a self-hosted analytics solution via a script tag in root.tsx, injected only when UMAMI_HOST and UMAMI_WEBSITE_ID are set
    • Local dev - set vars -> script loads, data goes to the local docker
    • Prod - set both vars in the worker, data does to production Umami
    • Any env without the vars set - script tag isn't rendered at all, zero analytics (i.e. no data pollution in staging)
  • Adds a local dev Umami instance via localenv/umami/docker-compose.yml

Event tracked as setup

Event Route
wallet_connected /banner, /widget, /offerwall
click_card_tool link

Notes

  • Umami automatically tracks page views for every route after the script tag loads

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Deployment results

Worker Alias URL Outcome
API - 9ef37f1b success
CDN - 6cb5d3b7 success
App - 063b8711 success

Logs #24389213856

Comment thread frontend/app/components/redesign/components/ToolsWalletAddress.tsx Outdated
Comment thread frontend/app/lib/umami.tsx Outdated
Comment thread frontend/app/lib/umami.tsx Outdated
Comment thread frontend/app/routes/offerwall.tsx Outdated
Comment thread localenv/umami/docker-compose.yml Outdated
Comment thread .env.sample Outdated
Comment thread frontend/app/components/redesign/components/ToolsWalletAddress.tsx Outdated
Comment thread frontend/app/routes/_index.tsx Outdated
Copy link
Copy Markdown
Collaborator

@kjmitchelljr kjmitchelljr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, agree with the feedback Sid gave, but see those changes have already been added 👍🏿

Comment thread frontend/app/root.tsx
Comment on lines +35 to +41
{UMAMI_HOST && UMAMI_WEBSITE_ID && (
<script
defer
src={`${UMAMI_HOST}/script.js`}
data-website-id={UMAMI_WEBSITE_ID}
/>
)}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: with this script injection here, do you think we should do any checks to make sure the URLs aren't malformed?

const walletAddressInfo = await getWalletAddress(walletAddressUrl)
walletActions.setWalletAddressId(walletAddressInfo.id)
await connect()
trackEvent('wallet_connected')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be a later add, but thinking keeping the events in a separate file with a const map of event names as more events get added

Comment thread docs/env-vars.md Outdated
Comment thread frontend/app/lib/umami.tsx Outdated
Comment thread frontend/app/lib/umami.tsx Outdated
Comment thread frontend/app/lib/umami.tsx Outdated
Comment thread frontend/app/root.tsx Outdated
Comment thread frontend/app/root.tsx
Comment thread package.json Outdated
Comment on lines +20 to +21
"analytics:start": "pnpm --filter localenv-analytics start",
"analytics:stop": "pnpm --filter localenv-analytics stop"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be replaced with pnpm -C localenv/analytics start command. If you believe that additional scripts like these are more ergonomic, feel free to keep them.

Comment thread localenv/analytics/package.json Outdated
Comment thread frontend/app/root.tsx Outdated
@DarianM DarianM merged commit 74a0e08 into main Apr 14, 2026
5 checks passed
@DarianM DarianM deleted the analytics branch April 14, 2026 19:05
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.

Infrastructure Integration

3 participants