Documentation Index
Fetch the complete documentation index at: https://mintlify.com/samgutentag/sbburgerweek/llms.txt
Use this file to discover all available pages before exploring further.
window.track(action, label) is defined in track.js and sends a fire-and-forget POST beacon to the Cloudflare Worker. If THEME.trackUrl is null (the default in a fresh fork), the function is a no-op — tracking is completely disabled and no network requests are made. Every user interaction with the map that is worth measuring fires a corresponding event via this function.
track.js source
The full implementation is intentionally minimal:- Self-contained IIFE — sets up
window.trackexactly once at page load. - Graceful no-op — if
THEME.trackUrlis falsy, the module returns immediately without definingwindow.track. All call sites inapp.jschecktypeof track !== "undefined"before calling it, so no errors occur. - Localhost guard — events are never sent during local development (
localhost,127.0.0.1,0.0.0.0), preventing test noise in the Analytics Engine dataset. sendBeacon— uses the Beacon API so events are delivered even when the page is closing (e.g. “Get Directions” click that opens a new tab).
Event reference
The table below lists every action tracked by the map application.| Action | When it fires | Label value |
|---|---|---|
view | Popup opened via map marker click or sidebar item click | Restaurant name |
sidebar-view | Sidebar list item scrolled into the visible viewport | Restaurant name |
directions-apple | Apple Maps directions link clicked in popup | Restaurant name |
directions-google | Google Maps directions link clicked in popup | Restaurant name |
website | Restaurant website link clicked | Restaurant name |
phone | Phone number link clicked | Restaurant name |
instagram | Instagram profile link clicked | Restaurant name |
share | Share button clicked (copies link or opens share sheet) | Restaurant name |
upvote | Like/favorite button toggled on | Restaurant name |
un-upvote | Like/favorite button toggled off | Restaurant name |
deeplink | Page loaded with a URL hash (#restaurant-slug) that auto-opens a popup | Restaurant name |
filter-area | Area filter button clicked in the sidebar filter bar | Area name (e.g. "Downtown") |
filter-tag | Dietary tag filter button clicked (vegetarian, gluten-free, etc.) | Tag name |
filter-hours | Hours-based filter clicked (Open Now, Lunch, Dinner) | Filter type string |
tip-s | Small tip tier button clicked in the tip jar modal | "tip-jar" |
tip-m | Medium tip tier button clicked in the tip jar modal | "tip-jar" |
tip-l | Large tip tier button clicked in the tip jar modal | "tip-jar" |
tip-share | Share button clicked inside the tip jar modal | "tip-jar" |
stats-view | Stats page (/stats) loaded | "stats" |
The
search action is also written to the Analytics Engine — it records the query string as the label. Search events are only accessible via the protected GET /?admin=true&token=X endpoint, not via the public stats GET endpoints.Using tracking data
OnceTHEME.trackUrl is set and the Worker is deployed, tracking data flows into Cloudflare Analytics Engine and is immediately queryable through the Worker’s GET endpoints.
Stats leaderboard (/stats) — GET / returns the per-restaurant action breakdown. The stats page uses these counts to rank restaurants by engagement, computing a weighted score from views, direction clicks, shares, and upvotes.
Trends chart (/stats) — GET /?hourly=true returns time-series data bucketed by hour. The stats page renders this as an area chart showing total event volume over the event week. Supplying &start=YYYY-MM-DD&end=YYYY-MM-DD constrains the window to your exact event dates.
Per-restaurant trend — GET /?hourly=true&label=RestaurantName returns hourly totals for a single restaurant, used to render sparklines or per-restaurant trend charts.
Concluded event — After the event ends, run ./snapshot-hourly.sh to write snapshots/hourly-events.json and snapshots/hourly-labels.json into the repo. The stats page loads these static files automatically once the event is marked concluded, so charts continue to work even after trackUrl is set back to null and the Worker stops receiving writes.