feat(analytics): add click extension link event tracking for banner and offerwall#683
feat(analytics): add click extension link event tracking for banner and offerwall#683kjmitchelljr wants to merge 44 commits into
Conversation
This reverts commit 51274ac.
Deployment results
Logs #25825486362 |
sidvishnoi
left a comment
There was a problem hiding this comment.
This will end up injecting umami into the website. It'll track the website's page views etc. Also, what if the site already has umami? Which window.track() will get used? Also, what if site's CSP doesn't allow unami script/API?
We should instead proxy the events from CDN to go via a custom endpoint in API. That'll mean calling umami API from our API, and not using umami script.
|
@sidvishnoi All the changes should be there now, adding in small test for POST, but wanted to ask about the Github Actions variables, right now I'm not seeing UMAMI related vars unless that is something still to add |
sidvishnoi
left a comment
There was a problem hiding this comment.
Two small details left. Rest is good!
| ...event, | ||
| payload: { | ||
| ...event.payload, | ||
| website: UMAMI_WEBSITE_ID, |
There was a problem hiding this comment.
Let's also add a tag for events from embeds.
| website: UMAMI_WEBSITE_ID, | |
| website: UMAMI_WEBSITE_ID, | |
| tag: 'embed', |
| payload: { | ||
| name: `embed.${tool}.${name}`, | ||
| url: `/embed/${tool}`, | ||
| data: { hostname, ...data }, | ||
| }, |
There was a problem hiding this comment.
Compared to umami.track(), we're missing the screen size details.
https://docs.umami.is/docs/tracker-functions#pageviews
Perhaps we should add it manually.
Summary
Adds
embed.{tool}.click_extension_linkevent tracking when visitors click "Install the Web Monetization Extension" in the banner or offerwall embedsArchitecture
navigator.sendBeacon) →POST /eventson the APIembed.*prefix), forwards to Umami's/api/sendwith publisher's geo headers (per Umami's CF docs)api/src/routes/events.ts) exportsEventPayload(inner payload) andEventBody(full envelope); CDN imports both so request bodies stay in sync with the server schematrackEventFactory(tool)captures host context once per script entry; returnedtrackEvent(name, data?)takespositional args
Follow Ups
Part of
#625 / #682
Three small departures from your original: