feat: notify Zapier webhook on installer download clicks - #25
Draft
YouyoungSeo wants to merge 2 commits into
Draft
feat: notify Zapier webhook on installer download clicks#25YouyoungSeo wants to merge 2 commits into
YouyoungSeo wants to merge 2 commits into
Conversation
Adds a click handler to the 4 pages that link to AskUI Desktop / AgentOS installers, pinging the same Zapier catch-hook the marketing site's notifyDownload uses (feeds the shared Slack channel / Google Sheet headcount). No cookie-consent gate needed — this is not analytics. - lib/tracking.ts: notifyDownload + sessionStorage UTM capture/read - components/download-link.tsx: client wrapper around Card / plain <a>, registered in components/mdx.tsx (follows the run-embed.tsx pattern since the MDX render tree has no runtime server to attach onClick to) - components/utm-capture.tsx: mounted in Provider, persists utm_* params from the landing URL to sessionStorage so a later download click on a different docs page still gets attributed Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per UK ICO / EU EDPB guidance, writing to any browser storage (session or local) for marketing/analytics attribution requires consent, and this repo has no consent banner. Replace the sessionStorage-based UTM capture with a plain read of the current page's own query string at the moment the download link is clicked — no storage of any kind. Tradeoff: a visitor who lands on one docs page via a campaign link and navigates to a different page before downloading no longer gets attributed. Only "the download page's own URL carries the UTM params" is covered now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
Hey @programminx-askui, quick compliance question before I take this out of draft. This PR adds a Zapier webhook that fires when someone clicks an AskUI Desktop / AgentOS download link, same idea as what's already live on the marketing site's
Two things I'd like your take on:
Thanks! |
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
Adds download tracking for the docs page. When someone downloads AskUI Desktop or AgentOS, we send the event to Zapier, which posts it to our private Slack channel and Google Sheet, including OS type and UTM source. Same webhook the marketing site's
/startpage already uses.Open question: the main site has cookie consent, but the docs page doesn't (there wasn't any tracking here at all before this PR). I got around that by reading UTM params straight off the page URL at click time instead of writing anything to cookies or storage, so I don't think this needs a consent banner. That said, this is more of a compliance call than an engineering one, so it'd be good to get a second pair of eyes on it.
Summary
notifyDownloadalready uses (askui-website'ssrc/lib/tracking.ts), so downloads from docs.askui.com land in the same Slack channel and Google Sheet. This isn't analytics, it just fires every time with no consent gate.lib/tracking.tshasnotifyDownload(source, label, os, utm). It builds aFormDatapayload (JSON would trigger a CORS preflight the Zapier hook can't answer), stamps it with Berlin local time, and sends it withkeepalive: trueso the request survives the browser navigating away for the download.components/download-link.tsxis a new client component. MDX has no runtime server since this is a static export, so it follows the same patternrun-embed.tsxalready uses: a client component registered incomponents/mdx.tsx. It wrapsCardwhen a title is passed in, otherwise renders a plain<a>. It never callspreventDefault.quickstart.mdx,get-started/install-desktop.mdx,agentos/installation/silent.mdx, andagentos/installation/service.mdx.utm_source,utm_medium,utm_campaign,utm_content,utm_term) get read straight fromwindow.location.searchwhen the link is clicked. No session storage, no local storage, no cookies, since UK ICO and EU EDPB guidance treats any of that as needing consent, and this repo doesn't have a consent banner. The tradeoff is that this only catches UTM params if they're on the download page's own URL. If someone picked them up on an earlier page and then navigated over, they won't carry through.Test plan
pnpm install,npx tsc --noEmit,npm run buildall pass. Static export builds clean and all 273 pages generate.next dev. The webhook fired exactly once per click every time, with the rightsource/label/os/timestampfields, andContent-Typecame through asmultipart/form-dataso there's no preflight.?utm_source=...&utm_medium=...) and confirmed it shows up in the webhook payload.npm run dev(http://localhost:3000/docs-rewrite/docs/quickstart).