From 6fbedb105e8872d8cbd6b1d699d4644f292d3a15 Mon Sep 17 00:00:00 2001 From: pstayet Date: Tue, 29 Sep 2026 12:02:27 -0700 Subject: [PATCH] Add a one-screen landing page at /start/ for paid traffic Paid X traffic is almost all phones, and on the home page it bounces in about a second. /start/ is a shorter page to test against it: one line on what shell does, then install, start your agent, and scan the QR code. On a phone, "Send these steps to my laptop" opens the share sheet. The page gets exactly what "/" gets: the same Content-Security-Policy, Google Analytics, first-party events and X base pixel (attributed to /start/). It reports as its own route ("start" in PostHog, "landing_start" on the statistics dashboard) so the two pages can be compared, and it is noindex so the home page stays the one search engines show. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01ScihqCEjAhjFfkvfSR3ZXN --- CHANGELOG.md | 10 + shared/landing-paths.ts | 10 + shared/posthog.ts | 6 +- shared/public-attribution.ts | 1 + start/index.html | 92 ++++++++++ tests/analytics.test.ts | 2 + tests/csp-ga.test.ts | 9 + tests/posthog.test.ts | 5 + tests/x-pixel.test.ts | 9 +- vite.config.ts | 1 + web/analytics.ts | 6 +- web/posthog.ts | 2 + web/start.css | 346 +++++++++++++++++++++++++++++++++++ web/start.ts | 81 ++++++++ web/x-pixel.ts | 5 +- worker/analytics.ts | 2 + worker/index.ts | 5 +- wrangler.example.jsonc | 1 + 18 files changed, 583 insertions(+), 10 deletions(-) create mode 100644 shared/landing-paths.ts create mode 100644 start/index.html create mode 100644 web/start.css create mode 100644 web/start.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index c1c5619f..394d68cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable user-visible changes are recorded here. Versions follow [Semantic Ve ## Unreleased +### Added + +- A one-screen landing page at `/start/` for paid traffic, to test against + the home page. It says what shell does in one line and gives the three + setup steps: install, start your agent (`shell claude`, or tap Codex, + Hermes, OpenCode or Cursor), and scan the QR code. On a phone, "Send these + steps to my laptop" opens the share sheet. The page gets the home page's + analytics and X pixel, is kept out of search results, and reports as its + own route (`start`, `landing_start` on the statistics dashboard). + ## [0.23.3] — 2026-09-25 ### Fixed diff --git a/shared/landing-paths.ts b/shared/landing-paths.ts new file mode 100644 index 00000000..e70beb04 --- /dev/null +++ b/shared/landing-paths.ts @@ -0,0 +1,10 @@ +/** + * The public landing pages. "/" is the home page; "/start/" is a one-screen + * page for paid traffic, tested against it. Both get the landing page's + * analytics, X pixel and Content-Security-Policy, and nothing else does. + */ +export const START_PATH = "/start/"; + +export function isLandingPath(pathname: string): boolean { + return pathname === "/" || pathname === "" || pathname === START_PATH; +} diff --git a/shared/posthog.ts b/shared/posthog.ts index 84e1887a..0ad08018 100644 --- a/shared/posthog.ts +++ b/shared/posthog.ts @@ -18,8 +18,8 @@ const EVENTS = new Set([ ]); const VALUES: Record> = { surface: new Set(["landing", "docs", "terminal", "app", "game", "relay"]), - route: new Set(["landing", "docs", "terminal", "login", "signup", "reset", "feedback", "account", "sessions", "session", "audit", "team", "join", "terms", "privacy", "machines", "game", "cli_authorize"]), - target: new Set(["install", "brew_install", "source_build", "run", "docs_command", "share", "skill", "start_nav", "start_hero", "start_footer", "start_bottom", "demo", "github_star", "signup_nav", "signup_hero", "signup_team", "signup_footer", "github", "signup", "signin", "docs", "app", "feedback", "session", "machine", "team", "vault", "automation", "account", "command", "invite", "cli", "unknown"]), + route: new Set(["landing", "start", "docs", "terminal", "login", "signup", "reset", "feedback", "account", "sessions", "session", "audit", "team", "join", "terms", "privacy", "machines", "game", "cli_authorize"]), + target: new Set(["install", "brew_install", "source_build", "run", "docs_command", "share", "skill", "start_nav", "start_hero", "start_footer", "start_bottom", "start_share", "demo", "github_star", "signup_nav", "signup_hero", "signup_team", "signup_footer", "github", "signup", "signin", "docs", "app", "feedback", "session", "machine", "team", "vault", "automation", "account", "command", "invite", "cli", "unknown"]), source: new Set(["x", "google", "github", "reddit", "hacker_news", "bing", "youtube", "linkedin", "facebook", "instagram", "direct", "internal", "other", "app", "newsletter", "product_hunt", "discord", "slack", "mastodon", "bluesky", "podcast"]), device: new Set(["mobile", "tablet", "desktop", "bot", "cli", "unknown"]), outcome: new Set([...OPERATION_OUTCOMES, "unsupported_os", "unsupported_arch", "download_failed", "checksum_mismatch", "unknown", "matched", "limit", "reset", "revoked", "error", "busy", "too_large", "conflict", "in_flight", "delivered", "delivery_uncertain"]), @@ -108,7 +108,7 @@ export function posthogPayload(event: string, id: string, input: Record + + + + + + + + + + + + + + + + + + + + + + + + + + + Use any coding agent from your phone | shell.online + + +
+
+ shell.online +
+ +
+
+

Use any coding agent from your phone.

+

Free and open source. No account needed.

+
+ +
+

How it works

+
    +
  1. +
    + + On your laptop, install shellInstall shell +
    + + +
    +
    +
    + curl -fsSL https://shell.online/install | sh + +
    +
  2. +
  3. +
    + + Start your agent through shell +
    +
    + shell claude + +
    +

    or + + + + +

    +
  4. +
  5. +
    + + Scan the QR code it prints with this phoneyour phone +
    +
  6. +
+
+
+ +
+ +

+
+
+ + + diff --git a/tests/analytics.test.ts b/tests/analytics.test.ts index 8766e2da..a2c5147a 100644 --- a/tests/analytics.test.ts +++ b/tests/analytics.test.ts @@ -152,6 +152,8 @@ describe("analytics", () => { it("names every documentation page, and keeps unknown paths apart from 404s", () => { expect(documentTarget("/", 200, "0.15.1")).toBe("landing"); + expect(documentTarget("/start/", 200, "0.15.1")).toBe("landing_start"); + expect(documentTarget("/start/", 404, "0.15.1")).toBe("not_found"); expect(documentTarget("/docs/", 200, "0.15.1")).toBe("docs"); expect(documentTarget("/app/", 200, "0.15.1")).toBe("docs_app"); expect(documentTarget("/cli/", 200, "0.15.1")).toBe("docs_cli"); diff --git a/tests/csp-ga.test.ts b/tests/csp-ga.test.ts index 00926ca0..e51367de 100644 --- a/tests/csp-ga.test.ts +++ b/tests/csp-ga.test.ts @@ -41,6 +41,15 @@ describe("secureAssetResponse CSP Google Analytics endpoints", () => { expect(privatePolicy).not.toMatch(/twitter|t\.co|ads-twitter/); } }); + it("gives the /start/ landing page the home page's analytics and X origins, and keeps it out of search", () => { + const home = csp(secureAssetResponse(htmlResponse(), "/", "shell.online")); + const start = secureAssetResponse(htmlResponse(), "/start/", "shell.online"); + expect(csp(start)).toBe(home); + expect(start.headers.get("X-Robots-Tag")).toBe("noindex, nofollow, noarchive"); + for (const [path, host] of [["/start", "shell.online"], ["/start/x", "shell.online"], ["/start/", "app.shell.online"]]) { + expect(csp(secureAssetResponse(htmlResponse(), path, host))).not.toMatch(/twitter|googletagmanager/); + } + }); it("allows GA on public landing page (/) HTML on shell.online", () => { const res = secureAssetResponse(htmlResponse(), "/", "shell.online"); const policy = csp(res); diff --git a/tests/posthog.test.ts b/tests/posthog.test.ts index 1ea56c53..cb1d0c11 100644 --- a/tests/posthog.test.ts +++ b/tests/posthog.test.ts @@ -165,6 +165,9 @@ describe("PostHog explicit capture boundary", () => { const payload = posthogPayload("$pageview", ID, { surface: "terminal", route: "terminal", target: SECRET, source: SECRET, url: SECRET, content: SECRET, token: SECRET, $current_url: SECRET, $set: { email: SECRET } }); expect(JSON.stringify(payload)).not.toContain(SECRET); expect(payload?.properties.$current_url).toBe("https://shell.online/s/:session"); + const start = posthogPayload("$pageview", ID, { surface: "landing", route: "start" }); + expect(start?.properties).toMatchObject({ $current_url: "https://shell.online/start/", $pathname: "/start/", $host: "shell.online", route: "start" }); + expect(posthogPayload("landing_cta", ID, { target: "start_share" })?.properties.target).toBe("start_share"); expect(payload?.properties.$process_person_profile).toBe(false); expect(payload?.properties.$geoip_disable).toBe(true); expect(posthogPayload(SECRET, ID)).toBeNull(); @@ -174,6 +177,8 @@ describe("PostHog explicit capture boundary", () => { for (const url of ["http://shell.online/", "https://evil.shell.online/", "https://stats.shell.online/", "https://app.shell.online/auth/callback?code=SECRET", "https://shell.online:444/", "https://shell.online/unknown"]) expect(analyticsRoute(new URL(url))).toBeNull(); expect(analyticsRoute(new URL(`https://app.shell.online/sessions/${SECRET}?token=${SECRET}`))).toEqual({ surface: "app", route: "session" }); expect(analyticsRoute(new URL("https://app.shell.online/game"))).toEqual({ surface: "game", route: "game" }); + expect(analyticsRoute(new URL("https://shell.online/start/?utm_source=x&utm_medium=paid_social"))).toEqual({ surface: "landing", route: "start" }); + expect(analyticsRoute(new URL("https://shell.online/start/other"))).toBeNull(); }); it("uses a finite acquisition source, never a raw URL/campaign/click ID", () => { expect(analyticsSource(new URL(`https://shell.online/?twclid=${SECRET}`), "")).toBe("x"); diff --git a/tests/x-pixel.test.ts b/tests/x-pixel.test.ts index c651fbf0..12d7666e 100644 --- a/tests/x-pixel.test.ts +++ b/tests/x-pixel.test.ts @@ -25,13 +25,19 @@ describe("X base pixel", () => { ["config", "rfilf"], ]); }); - it.each(["/"])("loads on public %s", async path => { + it.each(["/", "/start/"])("loads on public %s", async path => { dom(`https://shell.online${path}?utm_source=x&twclid=valid_click-123`); (await import("../web/x-pixel")).initXPixel(); expect(scripts).toHaveLength(1); }); + it("attributes the /start/ visit to /start/, not the home page", async () => { + const w = dom("https://shell.online/start/?utm_source=x&utm_medium=paid_social"); + (await import("../web/x-pixel")).initXPixel(); + expect(Array.from(w.twq!.queue[0])).toEqual(["set", { page_location: "https://shell.online/start/" }]); + }); it.each([ "https://shell.online/s/abcdefghijklmnopqrstuvwxyz012345#salt=SECRET", + "https://shell.online/start", "https://shell.online/start/extra", "https://shell.online/start/?password=SECRET", "https://app.shell.online/", "https://stats.shell.online/", "http://shell.online/", "https://shell.online/docs/", "https://shell.online/cli/", "https://shell.online/docs/v0.23.0/security/", "http://localhost:5178/", "https://shell.online/oauth/callback", "https://shell.online/?password=SECRET", @@ -62,6 +68,7 @@ describe("X base pixel", () => { }); it("is wired only to the landing entry point", () => { expect(readFileSync("web/landing.ts", "utf8")).toContain("initXPixel();"); + expect(readFileSync("web/start.ts", "utf8")).toContain("initXPixel();"); expect(readFileSync("web/documentation-entry.ts", "utf8")).not.toContain("x-pixel"); expect(readFileSync("web/main.ts", "utf8")).not.toContain("x-pixel"); expect(readFileSync("app/src/components/ProductAnalytics.tsx", "utf8")).not.toContain("x-pixel"); diff --git a/vite.config.ts b/vite.config.ts index 2559065a..be613c16 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -126,6 +126,7 @@ export default defineConfig({ input: { main: resolve(import.meta.dirname, "index.html"), documentation: resolve(import.meta.dirname, "web/documentation.html"), + start: resolve(import.meta.dirname, "start/index.html"), }, }, }, diff --git a/web/analytics.ts b/web/analytics.ts index 08934ef1..7b62965e 100644 --- a/web/analytics.ts +++ b/web/analytics.ts @@ -2,6 +2,7 @@ import { resolveDocumentationRoute } from "../shared/documentation"; import { RELEASE_VERSION } from "../shared/release"; import { campaignMedium, isPublicEvent, publicSource } from "../shared/public-attribution"; import { trackProduct } from "./posthog"; +import { isLandingPath, START_PATH } from "../shared/landing-paths"; const GA_ID = "G-101HMD03VD"; const LEGACY_CONSENT_COOKIE = "shell_analytics_consent"; @@ -10,7 +11,7 @@ const GA_COOKIE_MAX_AGE = 7_776_000; // 90 days const PUBLIC_HOST = "shell.online"; function isPublicPath(pathname: string): boolean { - if (pathname === "/" || pathname === "") return true; + if (isLandingPath(pathname)) return true; return resolveDocumentationRoute(pathname, RELEASE_VERSION) !== null; } @@ -60,6 +61,7 @@ function canonicalPageLocation(url: URL): string { function pageTitleFor(pathname: string): string { if (pathname === "/" || pathname === "") return "Your terminal, anywhere | shell.online"; + if (pathname === START_PATH) return "Use any coding agent from your phone | shell.online"; const guide = resolveDocumentationRoute(pathname, RELEASE_VERSION); if (guide) return `${guide.kind === "docs" ? "Getting started" : guide.kind} | shell.online docs`; return "shell.online"; @@ -105,7 +107,7 @@ export function initAnalytics(): void { if (!publicLoaded) { publicLoaded = true; - sendPublicEvent("page_loaded", url.pathname === "/" ? "landing" : "docs", url); + sendPublicEvent("page_loaded", isLandingPath(url.pathname) ? "landing" : "docs", url); } gtagLoaded = true; diff --git a/web/posthog.ts b/web/posthog.ts index 4bac98a0..ca352a9d 100644 --- a/web/posthog.ts +++ b/web/posthog.ts @@ -1,4 +1,5 @@ import { resolveDocumentationRoute } from "../shared/documentation"; +import { START_PATH } from "../shared/landing-paths"; import { RELEASE_VERSION } from "../shared/release"; import { sendPosthog, type PosthogCaptureContext } from "../shared/posthog"; import { campaignMedium, campaignSource, classifyReferrer, publicSource } from "../shared/public-attribution"; @@ -29,6 +30,7 @@ export function analyticsRoute(url: URL): { surface: string; route: string; guid if (url.hostname === "shell.online") { if (/^\/s\/[A-Za-z0-9_-]{32}\/?$/.test(url.pathname)) return { surface: "terminal", route: "terminal" }; if (url.pathname === "/") return { surface: "landing", route: "landing" }; + if (url.pathname === START_PATH) return { surface: "landing", route: "start" }; const guide = resolveDocumentationRoute(url.pathname, RELEASE_VERSION); if (guide) return { surface: "docs", route: "docs", guide: guide.kind }; } diff --git a/web/start.css b/web/start.css new file mode 100644 index 00000000..2b7b65f1 --- /dev/null +++ b/web/start.css @@ -0,0 +1,346 @@ +@font-face { + font-family: "Uncut Sans"; + src: url("/fonts/uncut-sans-variable.woff2") format("woff2"); + font-weight: 300 700; + font-display: swap; +} + +/* The one-screen landing page for paid traffic (/start/). Same palette as the home page. */ +.start-root { + --ink: #1c251f; + --muted: #586258; + --faint: #6b7468; + --paper: #f7f8f2; + --card: #ffffff; + --line: #e3e7dc; + --well: #f3f5ee; + --tint: #eef4d6; + --lime: #d5f568; + background: var(--paper); + color: var(--ink); + -webkit-text-size-adjust: 100%; +} +.start-root body { + margin: 0; + background: var(--paper); + font-family: "Uncut Sans", system-ui, -apple-system, "Segoe UI", sans-serif; + line-height: 1.45; +} +.start-root *, +.start-root *::before, +.start-root *::after { + box-sizing: border-box; +} +.start-root code, +.start-root button[data-agent] { + font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; +} +.start-root button { + font: inherit; + color: inherit; + cursor: pointer; +} +.start-root :focus-visible { + outline: 2px solid var(--ink); + outline-offset: 2px; +} + +.start { + min-height: 100dvh; + max-width: 1280px; + margin: 0 auto; + padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom)); + display: flex; + flex-direction: column; +} +.start-brand a { + display: inline-flex; + align-items: center; + gap: 8px; + font-size: 17px; + font-weight: 650; + color: inherit; + text-decoration: none; +} +.start-mark { + width: 18px; + height: 18px; + border-radius: 5px; + background: var(--lime); + border: 1.5px solid var(--ink); +} + +.start-layout { + display: flex; + flex-direction: column; + gap: 22px; + margin-top: 22px; +} +.start-intro { + display: flex; + flex-direction: column; + gap: 8px; +} +.start-intro h1 { + margin: 0; + font-size: 34px; + line-height: 1.03; + font-weight: 700; + letter-spacing: -0.035em; + text-wrap: balance; +} +.start-intro p { + margin: 0; + font-size: 15px; + font-weight: 500; + color: var(--muted); +} + +.start-how { + display: flex; + flex-direction: column; + gap: 8px; +} +.start-how h2 { + margin: 0 0 2px; + font-size: 13px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; + color: var(--muted); +} +.start-steps { + margin: 0; + padding: 0; + list-style: none; + display: flex; + flex-direction: column; + gap: 8px; +} +.start-step { + padding: 12px; + background: var(--card); + border: 1px solid var(--line); + border-radius: 14px; + display: flex; + flex-direction: column; + gap: 8px; +} +.start-step-head { + display: flex; + align-items: center; + gap: 10px; + flex-wrap: wrap; +} +.start-number { + width: 24px; + height: 24px; + flex: none; + border-radius: 50%; + background: var(--tint); + color: #3d4a3f; + font-size: 13px; + font-weight: 700; + display: inline-flex; + align-items: center; + justify-content: center; +} +.start-step-last .start-number { + background: var(--lime); + color: var(--ink); +} +.start-step-title { + flex: 1; + min-width: 0; + font-size: 16px; + font-weight: 600; +} + +.start-os { + display: none; + gap: 4px; + padding: 3px; + border-radius: 9px; + background: var(--well); +} +.start-os button { + min-height: 30px; + padding: 0 12px; + font-size: 13px; + font-weight: 600; + border-radius: 7px; + border: 1px solid transparent; + background: transparent; + color: var(--muted); +} +.start-os button[aria-pressed="true"] { + background: var(--card); + border-color: var(--line); + color: var(--ink); +} + +.start-command { + display: flex; + align-items: center; + gap: 8px; + padding: 6px 6px 6px 10px; + border-radius: 9px; + background: var(--well); +} +.start-command code { + flex: 1; + min-width: 0; + font-size: 11px; + letter-spacing: -0.02em; + white-space: nowrap; + overflow-x: auto; + scrollbar-width: none; +} +#start-run { + font-size: 14px; + letter-spacing: 0; +} +.start-copy { + display: none; + flex: none; + min-height: 36px; + padding: 0 14px; + font-size: 14px; + font-weight: 600; + border-radius: 8px; + border: 1px solid #dce2d7; + background: var(--card); +} + +.start-agents { + margin: 0; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px; + font-size: 13px; + color: var(--faint); +} +.start-agents button { + min-height: 28px; + padding: 3px 7px; + font-size: 12px; + border-radius: 6px; + border: 1px solid var(--line); + background: transparent; + color: #3d4a3f; +} +.start-agents button[aria-pressed="true"] { + border-color: var(--ink); + background: var(--tint); +} + +.start-send { + margin-top: auto; + padding-top: 16px; + display: flex; + flex-direction: column; + gap: 6px; +} +#start-send { + min-height: 52px; + border: 0; + border-radius: 14px; + background: var(--ink); + color: var(--paper); + font-size: 17px; + font-weight: 650; +} +#start-status:empty { + display: none; +} +#start-status { + margin: 0; + font-size: 14px; + color: var(--muted); + text-align: center; +} + +.start-desktop-only { + display: none; +} + +/* The smallest phones: keep the install command on one line. */ +@media (max-width: 379px) { + .start-command code { + font-size: 10px; + } +} + +/* A laptop: the steps sit beside the headline, copy buttons and the OS switch appear, and there is nothing to send. */ +@media (min-width: 900px) { + .start { + padding: 24px 64px 48px; + min-height: 100dvh; + } + .start-layout { + flex: 1; + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 72px; + align-items: center; + margin-top: 0; + } + .start-intro { + gap: 16px; + } + .start-how, + .start-steps { + gap: 12px; + } + .start-intro h1 { + font-size: 60px; + line-height: 1.02; + } + .start-intro p { + font-size: 18px; + } + .start-step { + padding: 18px 20px; + border-radius: 16px; + gap: 12px; + } + .start-number { + width: 28px; + height: 28px; + font-size: 14px; + } + .start-step-title { + font-size: 18px; + } + .start-os { + display: flex; + } + .start-command { + padding-left: 14px; + border-radius: 10px; + } + .start-command code, + #start-run { + font-size: 15px; + letter-spacing: 0; + } + .start-copy { + display: inline-block; + } + .start-agents { + font-size: 14px; + } + .start-agents button { + font-size: 13px; + } + .start-send { + display: none; + } + .start-phone-only { + display: none; + } + .start-desktop-only { + display: inline; + } +} diff --git a/web/start.ts b/web/start.ts new file mode 100644 index 00000000..401db3b2 --- /dev/null +++ b/web/start.ts @@ -0,0 +1,81 @@ +import { initAnalytics, trackPublicEvent } from "./analytics"; +import { initXPixel } from "./x-pixel"; +import { observeProductPage } from "./posthog"; +import { agentCommand } from "./landing-brands"; + +const INSTALL = { + unix: "curl -fsSL https://shell.online/install | sh", + windows: "irm https://shell.online/install.ps1 | iex", +} as const; + +/* The link a phone sends on. Plain, so the laptop visit is not counted as a second ad click. */ +const SHARE_URL = "https://shell.online/start/"; + +export function initStart(): void { + initAnalytics(); + initXPixel(); + observeProductPage(); + + const install = document.querySelector("#start-install"); + const run = document.querySelector("#start-run"); + const status = document.querySelector("#start-status"); + const say = (text: string) => { + if (status) status.textContent = text; + }; + + const osButtons = [...document.querySelectorAll("[data-os]")]; + const setOs = (os: string) => { + if (os !== "unix" && os !== "windows") return; + if (install) install.textContent = INSTALL[os]; + osButtons.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.os === os))); + }; + setOs(/Windows/i.test(navigator.userAgent) ? "windows" : "unix"); + osButtons.forEach((b) => b.addEventListener("click", () => setOs(b.dataset.os ?? ""))); + + // An example is also a choice: tapping one swaps it into step 2. + const agentButtons = [...document.querySelectorAll("[data-agent]")]; + agentButtons.forEach((b) => + b.addEventListener("click", () => { + const command = agentCommand(b.dataset.agent ?? ""); + if (!command || !run) return; + run.textContent = command; + agentButtons.forEach((other) => other.setAttribute("aria-pressed", String(other === b))); + }), + ); + + document.querySelectorAll("[data-copy]").forEach((button) => + button.addEventListener("click", () => { + const target = button.dataset.copy === "run" ? "run" : "install"; + const text = (target === "run" ? run : install)?.textContent ?? ""; + trackPublicEvent("copy", target); + navigator.clipboard?.writeText(text).then( + () => { + button.textContent = "Copied"; + window.setTimeout(() => (button.textContent = "Copy"), 1600); + }, + () => say("Select the command and copy it."), + ); + }), + ); + + document.querySelector("#start-send")?.addEventListener("click", async () => { + trackPublicEvent("cta_click", "start_share"); + const shareData = { title: "Set up shell.online", text: "Set up shell on my laptop:", url: SHARE_URL }; + if (navigator.share) { + try { + await navigator.share(shareData); + return; + } catch (error) { + if ((error as DOMException)?.name === "AbortError") return; + } + } + try { + await navigator.clipboard.writeText(SHARE_URL); + say("Link copied. Paste it into a message or note to yourself."); + } catch { + say(`Open ${SHARE_URL.replace("https://", "")} on your laptop.`); + } + }); +} + +initStart(); diff --git a/web/x-pixel.ts b/web/x-pixel.ts index c4c16461..4dd6120b 100644 --- a/web/x-pixel.ts +++ b/web/x-pixel.ts @@ -1,4 +1,5 @@ import { hasAnalyticsOptOut, isGpcOrDnt, isPublicAnalyticsUrl } from "./analytics"; +import { isLandingPath } from "../shared/landing-paths"; // Public advertiser ID, not the server-side Conversion API token. export const X_PIXEL_ID = "rfilf"; @@ -14,7 +15,7 @@ type PixelQueue = ((...args: unknown[]) => void) & { export function initXPixel(): void { try { const url = new URL(window.location.href); - if (url.pathname !== "/" || !isPublicAnalyticsUrl(url) || isGpcOrDnt() || hasAnalyticsOptOut()) return; + if (!isLandingPath(url.pathname) || !isPublicAnalyticsUrl(url) || isGpcOrDnt() || hasAnalyticsOptOut()) return; // The vendor extracts this value itself. Refuse malformed/unbounded click IDs. const clicks = url.searchParams.getAll("twclid"); if (clicks.length > 1 || (clicks.length === 1 && !/^[A-Za-z0-9_-]{1,256}$/.test(clicks[0]))) return; @@ -28,7 +29,7 @@ export function initXPixel(): void { w.twq = twq; // Keep landing-page attribution, never the raw query/fragment or referrer. // The vendor replaces both location and a nonempty referrer with this URL. - twq("set", { page_location: "https://shell.online/" }); + twq("set", { page_location: `https://shell.online${url.pathname || "/"}` }); // Disable vendor defaults that capture button text, form fields, dataLayer // events and timed engagement. These switches are verified against uwt.js // by the real-script browser gate, not just a mocked queue. diff --git a/worker/analytics.ts b/worker/analytics.ts index bb9f1b9a..d371e07a 100644 --- a/worker/analytics.ts +++ b/worker/analytics.ts @@ -1,4 +1,5 @@ import { resolveDocumentationRoute } from "../shared/documentation"; +import { START_PATH } from "../shared/landing-paths"; import type { UniqueSurface } from "../shared/stats"; import { campaignSource, classifyReferrer, PUBLIC_CTA_TARGETS } from "../shared/public-attribution"; export { campaignSource, classifyReferrer } from "../shared/public-attribution"; @@ -265,6 +266,7 @@ export function uniqueSurface(event: AnalyticsEvent, target: string): UniqueSurf export function documentTarget(pathname: string, status: number, currentVersion: string): string { if (status === 404) return "not_found"; if (pathname === "/") return "landing"; + if (pathname === START_PATH) return "landing_start"; const route = resolveDocumentationRoute(pathname, currentVersion); if (route) return route.kind === "docs" ? "docs" : `docs_${route.kind.replace(/-/g, "_")}`; if (SESSION_PATH.test(pathname)) return "session"; diff --git a/worker/index.ts b/worker/index.ts index ea331a02..ce602153 100644 --- a/worker/index.ts +++ b/worker/index.ts @@ -1,4 +1,5 @@ import { DurableObject } from "cloudflare:workers"; +import { isLandingPath } from "../shared/landing-paths"; import { sendPosthog } from "../shared/posthog"; import { relayOperation, httpOutcome, type OperationOutcome } from "../shared/analytics-operations"; import { safeSource } from "../shared/public-attribution"; @@ -4219,7 +4220,7 @@ function isStatsRequestHost(request: Request, url: URL): boolean { } function isPublicAnalyticsPath(pathname: string): boolean { - if (pathname === "/" || pathname === "") return true; + if (isLandingPath(pathname)) return true; return resolveDocumentationRoute(pathname, RELEASE_VERSION) !== null; } @@ -4227,7 +4228,7 @@ export function secureAssetResponse(response: Response, pathname: string, hostna const headers = new Headers(response.headers); const isHtmlDocument = headers.get("Content-Type")?.toLowerCase().startsWith("text/html") ?? false; const gaAllowed = isHtmlDocument && hostname === "shell.online" && isPublicAnalyticsPath(pathname); - const xAllowed = gaAllowed && pathname === "/"; + const xAllowed = gaAllowed && isLandingPath(pathname); const xCollectors = xAllowed ? " https://analytics.twitter.com https://t.co https://ads-twitter.com https://ads-api.twitter.com" : ""; const posthogAllowed = gaAllowed || (isHtmlDocument && hostname === "shell.online" && /^\/s\/[A-Za-z0-9_-]{32}\/?$/.test(pathname)); headers.set("Content-Security-Policy", [ diff --git a/wrangler.example.jsonc b/wrangler.example.jsonc index 58cc9dc5..fd24673a 100644 --- a/wrangler.example.jsonc +++ b/wrangler.example.jsonc @@ -33,6 +33,7 @@ "/e2ee/*", "/docker/*", "/self-hosting/*", + "/start/*", "/" ] },