Repository navigation
[OPEND-4849] feat(motion): attribute installs through optional campaign links #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c1a8d08
67fc80c
6e604e5
1277b6a
6509ce2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Installation attribution | ||
|
|
||
| Website URL `?utm_source=producthunt` → copied guide URL with the same query → Worker adds `--utm-source=producthunt` to setup commands → installer saves the source → subsequent events carry `od_utm_source`. | ||
|
|
||
| ## Compatibility | ||
|
|
||
| - No source: the original guide and setup command work unchanged; a new identity has an unknown source. | ||
| - Untagged upgrade: keep the saved source and installation ID. | ||
| - Explicit new source: update the source while retaining the installation ID. | ||
| - The release policy applies: test/prerelease builds do not collect installation attribution or send events. Stable builds honor saved telemetry preferences and environment opt-outs. Reporting failure never fails installation. | ||
| - Website current-visit attribution is separate from the existing first-touch cookie. Existing page/tab prompts do not change when another tab arrives from another campaign. | ||
|
|
||
| ## Deployment order | ||
|
|
||
| 1. Merge and publish the installer supporting `--utm-source`. Guide generation reads the packaged installer and includes `<!-- openmotion-utm-source-supported -->` only when that exact installer accepts the option, so a guide sealed for an older integrated source never offers it. | ||
| 2. Deploy `wrangler deploy --config workers/install-guide/wrangler.toml` in the Powerformer account. The binding reads the existing `open-design-releases` bucket; it does not upload or modify release objects. | ||
| 3. Verify the test entry `open-design.powerformer.net/motion/install.md` against both attributed and direct requests. The Worker maps this host to `open-motion/dev/install.md`. | ||
| 4. After validation, enable `open-design.ai/motion/install.md` separately; it maps to `open-motion/install.md`. The checked-in route activates only the test host. Other website and R2 paths remain unchanged. Removing the added route rolls back the new entry; existing R2 links remain available. | ||
|
|
||
| Both entries may serve older guides without injecting a parameter; injection starts only after a supporting installer and marked guide are published. Website feature previews, and the template prompts they copy, use the test installation entry, while their Pages deployment stays on the feature branch. Copied template prompts keep the existing R2 guide for prod until step 4 activates and verifies that entry. R2 upload/readback origins are not installation entry URLs. | ||
|
|
||
| An older guide without the marker is served unchanged, even when a source query is supplied. Transformed responses use `Cache-Control: no-store` to prevent channel mixing. Unrecognized paths return 404; GET and HEAD are supported. | ||
|
|
||
| ## Measurement | ||
|
|
||
| Filter Motion events by `product=openmotion`, environment, date and `od_utm_source`. Count successful installation devices by distinct `installation_id`; count project-creating devices and projects using successful `project_create_result` events. Reinstalls are events, not additional devices. Website copy success is a separate measurement and does not prove installation. There is no cross-device or website-to-client person matching. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import path from 'node:path'; | ||
| import { saveInstallationSource } from '../tracking/node.ts'; | ||
| import { createAppTracking, closeTracking, trackingLocked, trackingPreference } from './tracking.ts'; | ||
|
|
||
| export async function recordInstallation(directory: string, host: 'codex' | 'claude' | 'deepseek' | 'workbuddy', source?: string) { | ||
| if (trackingLocked() || !trackingPreference(directory)) return; | ||
| await saveInstallationSource(path.join(directory, 'tracking'), source); | ||
| const tracking = await createAppTracking(directory, 'installer'); | ||
| tracking.track('installation_result', { outcome: 'success', host_product: host }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Assert that the installation_result event actually reaches the sender
Add one test that drives 🔁 Powered by Looper · runner=reviewer · agent=omp · An autonomous AI dev team for your GitHub repos. |
||
| await closeTracking(tracking); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ it('only editable templates open a new engineering project; references copy thei | |
| await act(async () => button('一键复制').click()); | ||
| expect(clipboard).toHaveBeenCalledOnce(); | ||
| expect(clipboard.mock.calls[0][0]).toContain('指定模板:Reference(hf-moment-M953)'); | ||
| expect(clipboard.mock.calls[0][0]).toContain('https://releases.open-design.ai/open-motion/dev/install.md'); | ||
| expect(clipboard.mock.calls[0][0]).toContain('https://open-design.powerformer.net/motion/install.md'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Keep the internal test host out of tracked test literals
Fix by never spelling the scheme plus domain in test code: export the dev guide URL from 🔁 Powered by Looper · runner=reviewer · agent=omp · An autonomous AI dev team for your GitHub repos. |
||
| expect(clipboard.mock.calls[0][0]).not.toContain('localhost'); | ||
| expect(state.open).toHaveBeenCalledTimes(1); | ||
| expect(container.textContent).toContain('已复制'); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.