feat: Count lvwwd.org campaign events - #9
Merged
Merged
Conversation
Add lvwwd.org, the Week Without Driving Las Vegas campaign site, to the event allowlist. Its ten browser events cover the campaign's success measures: sign-ups, "Open my week" link requests, trip entries, trip pictures, bingo progress, Find a bus, installs, printed materials and the mail-in instructions. Every property is a campaign day, a running count or a fixed label, so no event carries a name, contact, link or place. The browser validators now read the shared allowlist instead of keeping their own copies of the placement and feature lists. Delegated data-lvbt attributes and the classic-script client therefore accept any declared event and property, and still refuse server-only events. The classic-script client grows to carry the larger allowlist, so its size budget rises from 1024 to 1792 bytes. Release the package as 0.2.0 and verify lvwwd.org in the weekly check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Astro integration set Vite's assetsInlineLimit to 0 so that Astro would never inline the analytics page script, which a script-src 'self' policy would block. Astro reads the same limit for stylesheets, so every page's small styles also became separate files. On lvwwd.org that added six stylesheet requests to its pages. The integration now passes a limit function that keeps script chunks external and hands every other asset to the site's own limit, or to Astro's default when the site sets none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
The shared analytics package can now count lvwwd.org's Week Without Driving campaign: sign-ups, "Open my week" link requests, trip entries by day, trip pictures, bingo progress, Find a bus, installs, printed materials and views of the mail-in instructions. Astro sites also keep their small stylesheets inline again. This PR prepares release 0.2.0.
Overview of Changes
Why this exists
lvwwd.org is the Week Without Driving Las Vegas campaign site, running October 1 to 8. It needs to know whether the campaign works, but version 0.1.0 of the package only knew the events of LVBT's other sites. Any lvwwd.org event threw in the browser, and the collector would have refused lvwwd.org as an origin, so the site could not use the package at all.
The campaign events
lvwwd.org is now a site in the event allowlist, with ten browser events of its own. Each one answers a campaign question:
campaign_signup,week_link_requested,trip_entry_submitted,trip_picture_shared,bingo_square_marked,bingo_completed,bus_finder_used,app_installed,material_printedandmail_in_viewed. The event allowlist reference now explains when each one is sent.The properties follow the privacy contract. Every value is a campaign day (1 to 8), a running count, or a fixed label such as
screenshotorpartner_flyer. A trip entry records its day and whether it came as a post link, a screenshot or both, but never the link. Find a bus records whether the person used their location or picked a place, but never the location. Bingo events carry how many squares or lines are done, which makes a progress funnel instead of per-square detail. A new test keeps every property value a short lowercase label, so free text cannot slip into the allowlist later.The collector needed no code change. It derives the permitted origins and each event's sites from the allowlist, so it accepts
https://lvwwd.organd still refuses LVBT events from lvwwd.org and campaign events from LVBT sites.One allowlist in the browser
Until now the browser code kept its own short copies of the
join_clickplacements andtool_feature_usedfeatures. That kept it small but meant every new event needed edits in three places. The browser now validates against the same allowlist as the collector. As a result, delegateddata-lvbt-*attributes work for any declared event: each property is read from the attribute of the same name, such asdata-lvbt-item, and an event without properties needs onlydata-lvbt-event. The API reference shows how classic scripts, like lvwwd.org's, callwindow.lvbt.tracksafely.Astro sites keep their small stylesheets inline
The Astro integration set Vite's
assetsInlineLimitto 0 so that Astro would never inline the analytics page script, which ascript-src 'self'policy would block. Astro uses the same limit to decide whether to inline small stylesheets, so every page's small styles also turned into separate files. On lvwwd.org that meant six extra stylesheet requests. The integration now keeps only script chunks external and leaves every other asset to the site's own limit, or to Astro's default when the site sets none. The design record always asked for scripts alone; this brings the code in line with it.Decisions worth knowing
The classic-script client now carries the allowlist, so it grows from about 1.0 KB to 1.7 KB gzipped, and its size budget rises from 1024 to 1792 bytes. The ES module that Astro and Vite sites bundle grows by a similar amount, about half a kilobyte. Keeping one allowlist was worth that cost, because two copies of a privacy boundary drift apart.
lvwwd.org is not a subdomain of lasvegasfortransit.org, so the organization's Web Analytics site does not cover it. The configuration reference now says that lvwwd.org has its own Web Analytics site, with its token in the week-without-driving repository's
productionenvironment.The weekly check now verifies
https://lvwwd.orgtoo. It will report lvwwd.org as missing until that site ships with its Web Analytics token.What must happen before it works live
The collector at
events.lasvegasfortransit.orghas never deployed. The Deploy collector workflow fails because the analytics repository'sproductionenvironment has noCLOUDFLARE_API_TOKENorCLOUDFLARE_ACCOUNT_IDsecret, and the hostname does not resolve today. Until a maintainer adds both and reruns the workflow, no site's events are recorded.Follow-ups
🤖 Generated with Claude Code