From 1f835036661a5924438e3b30e023dcfc408e9fb8 Mon Sep 17 00:00:00 2001 From: Claude <8926560+pubkey@users.noreply.github.com> Date: Thu, 16 Jul 2026 13:17:47 +0000 Subject: [PATCH 1/2] docs: expire stale ad click ids before sending conversions to the worker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gclid/gbraid/wbraid stored by storeAdClickId() in localStorage never expired, so getStoredAdClickId() kept returning it indefinitely. Every later tracking event — including organic return visits weeks or months after the ad click — was then posted to the conversion worker attributed to that stale click. Google Ads rejects those uploads as "this click is too old", and even when it doesn't, crediting a much-later visit to a long-past click is wrong. Ignore (and clear) stored click ids older than 90 days — Google Ads' maximum click-through conversion window — so we only ever call the worker with a click id that can still be legitimately attributed. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_018HtuEgSWKF1H2RYjupj8hF --- docs-src/src/components/trigger-event.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs-src/src/components/trigger-event.tsx b/docs-src/src/components/trigger-event.tsx index f427397e419..b43d8688ba3 100644 --- a/docs-src/src/components/trigger-event.tsx +++ b/docs-src/src/components/trigger-event.tsx @@ -36,6 +36,15 @@ const CONVERSION_WORKER_URL = 'https://rxdb-events.daniel-meyer-e90.workers.dev' */ export const AD_CLICK_STORAGE_ID = 'click_id'; +/** + * Google Ads' maximum click-through conversion window is 90 days. A stored + * click id older than that can never be imported ("this click is too old"), + * and attributing a later (often organic) visit to a months-old ad click would + * be wrong anyway. So we ignore — and clear — stale ids instead of uploading + * conversions against them forever. + */ +const AD_CLICK_MAX_AGE_MS = 90 * 24 * 60 * 60 * 1000; + function getStoredAdClickId(): { k: string; v: string; t: number; } | null { try { const raw = localStorage.getItem(AD_CLICK_STORAGE_ID); @@ -46,6 +55,10 @@ function getStoredAdClickId(): { k: string; v: string; t: number; } | null { if (!parsed || !parsed.v) { return null; } + if (typeof parsed.t !== 'number' || Date.now() - parsed.t > AD_CLICK_MAX_AGE_MS) { + localStorage.removeItem(AD_CLICK_STORAGE_ID); + return null; + } return parsed; } catch (err) { return null; From 965333df1247800d3eab4bcddfecbb78fd9f5272 Mon Sep 17 00:00:00 2001 From: Claude <8926560+pubkey@users.noreply.github.com> Date: Thu, 16 Jul 2026 13:20:40 +0000 Subject: [PATCH 2/2] docs: avoid em-dashes in comment (check-em-dashes CI guard) Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_018HtuEgSWKF1H2RYjupj8hF --- docs-src/src/components/trigger-event.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-src/src/components/trigger-event.tsx b/docs-src/src/components/trigger-event.tsx index b43d8688ba3..1be7fab82cf 100644 --- a/docs-src/src/components/trigger-event.tsx +++ b/docs-src/src/components/trigger-event.tsx @@ -40,7 +40,7 @@ export const AD_CLICK_STORAGE_ID = 'click_id'; * Google Ads' maximum click-through conversion window is 90 days. A stored * click id older than that can never be imported ("this click is too old"), * and attributing a later (often organic) visit to a months-old ad click would - * be wrong anyway. So we ignore — and clear — stale ids instead of uploading + * be wrong anyway. So we ignore (and clear) stale ids instead of uploading * conversions against them forever. */ const AD_CLICK_MAX_AGE_MS = 90 * 24 * 60 * 60 * 1000;