@amplitude/wizard 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -1
- package/dist/bin.js +47 -11
- package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.js +11 -1
- package/dist/src/frameworks/react-router/react-router-wizard-agent.js +65 -8
- package/dist/src/frameworks/vue/vue-wizard-agent.js +6 -1
- package/dist/src/lib/agent-interface.js +46 -0
- package/dist/src/lib/agent-runner.js +112 -51
- package/dist/src/lib/api.d.ts +35 -0
- package/dist/src/lib/api.js +118 -0
- package/dist/src/lib/commandments.js +1 -0
- package/dist/src/lib/constants.d.ts +1 -1
- package/dist/src/lib/constants.js +3 -3
- package/dist/src/lib/credential-resolution.js +7 -0
- package/dist/src/lib/framework-config.d.ts +9 -0
- package/dist/src/lib/mcp-with-fallback.d.ts +43 -0
- package/dist/src/lib/mcp-with-fallback.js +220 -0
- package/dist/src/lib/version-check.d.ts +17 -0
- package/dist/src/lib/version-check.js +72 -0
- package/dist/src/lib/wizard-session.d.ts +22 -7
- package/dist/src/lib/wizard-session.js +5 -3
- package/dist/src/run.d.ts +18 -1
- package/dist/src/run.js +104 -15
- package/dist/src/ui/agent-ui.d.ts +2 -0
- package/dist/src/ui/agent-ui.js +10 -0
- package/dist/src/ui/logging-ui.d.ts +2 -0
- package/dist/src/ui/logging-ui.js +6 -0
- package/dist/src/ui/tui/components/ConsoleView.js +14 -1
- package/dist/src/ui/tui/components/JourneyStepper.js +1 -3
- package/dist/src/ui/tui/flows.d.ts +0 -1
- package/dist/src/ui/tui/flows.js +1 -9
- package/dist/src/ui/tui/ink-ui.d.ts +2 -0
- package/dist/src/ui/tui/ink-ui.js +6 -0
- package/dist/src/ui/tui/screen-registry.js +0 -2
- package/dist/src/ui/tui/screens/DataIngestionCheckScreen.d.ts +5 -3
- package/dist/src/ui/tui/screens/DataIngestionCheckScreen.js +124 -4
- package/dist/src/ui/tui/screens/OutroScreen.js +12 -3
- package/dist/src/ui/tui/store.d.ts +22 -3
- package/dist/src/ui/tui/store.js +52 -18
- package/dist/src/ui/tui/utils/diagnostics.js +1 -3
- package/dist/src/ui/wizard-ui.d.ts +8 -0
- package/dist/src/utils/analytics.d.ts +15 -0
- package/dist/src/utils/analytics.js +37 -0
- package/dist/src/utils/setup-utils.js +6 -1
- package/package.json +2 -2
- package/skills/integration/integration-android/SKILL.md +7 -10
- package/skills/integration/integration-android/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-android/references/android.md +1468 -0
- package/skills/integration/integration-android/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-android/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-android/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-angular/SKILL.md +6 -8
- package/skills/integration/integration-angular/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-angular/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-angular/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-angular/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-angular/references/browser-sdk-2.md +67 -20
- package/skills/integration/{integration-swift/references/analytics.md → integration-angular/references/browser-unified-sdk.md} +591 -157
- package/skills/integration/integration-astro-hybrid/SKILL.md +6 -13
- package/skills/integration/integration-astro-hybrid/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-astro-hybrid/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-astro-hybrid/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-astro-hybrid/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-astro-hybrid/references/browser-sdk-2.md +67 -20
- package/skills/integration/{integration-android/references/analytics.md → integration-astro-hybrid/references/browser-unified-sdk.md} +591 -157
- package/skills/integration/integration-astro-ssr/SKILL.md +6 -11
- package/skills/integration/integration-astro-ssr/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-astro-ssr/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-astro-ssr/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-astro-ssr/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-astro-ssr/references/browser-sdk-2.md +67 -20
- package/skills/integration/{integration-javascript_node/references/analytics.md → integration-astro-ssr/references/browser-unified-sdk.md} +591 -157
- package/skills/integration/integration-astro-static/SKILL.md +6 -8
- package/skills/integration/integration-astro-static/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-astro-static/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-astro-static/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-astro-static/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-astro-static/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-astro-static/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-astro-view-transitions/SKILL.md +6 -10
- package/skills/integration/integration-astro-view-transitions/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-astro-view-transitions/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-astro-view-transitions/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-django/SKILL.md +5 -16
- package/skills/integration/integration-django/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-django/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-django/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-django/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-django/references/python.md +1 -1
- package/skills/integration/integration-expo/SKILL.md +8 -13
- package/skills/integration/integration-expo/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-expo/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-expo/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-expo/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-expo/references/react-native-sdk.md +11 -10
- package/skills/integration/integration-fastapi/SKILL.md +5 -16
- package/skills/integration/integration-fastapi/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-fastapi/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-fastapi/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-fastapi/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-fastapi/references/python.md +1 -1
- package/skills/integration/integration-flask/SKILL.md +5 -15
- package/skills/integration/integration-flask/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-flask/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-flask/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-flask/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-flask/references/python.md +1 -1
- package/skills/integration/integration-javascript_node/SKILL.md +6 -12
- package/skills/integration/integration-javascript_node/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-javascript_node/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-javascript_node/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-javascript_node/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-javascript_node/references/node.md +1457 -0
- package/skills/integration/integration-javascript_web/SKILL.md +7 -16
- package/skills/integration/integration-javascript_web/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-javascript_web/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-javascript_web/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-javascript_web/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-javascript_web/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-javascript_web/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-laravel/SKILL.md +5 -11
- package/skills/integration/integration-laravel/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-laravel/references/analytics.md +1 -1
- package/skills/integration/integration-laravel/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-laravel/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-laravel/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-nextjs-app-router/SKILL.md +6 -13
- package/skills/integration/integration-nextjs-app-router/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-nextjs-app-router/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-nextjs-app-router/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-nextjs-pages-router/SKILL.md +6 -13
- package/skills/integration/integration-nextjs-pages-router/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-nextjs-pages-router/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-nextjs-pages-router/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-nuxt-3.6/SKILL.md +6 -5
- package/skills/integration/integration-nuxt-3.6/references/EXAMPLE.md +1 -1
- package/skills/integration/integration-nuxt-3.6/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-nuxt-3.6/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-nuxt-3.6/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-nuxt-4/SKILL.md +6 -5
- package/skills/integration/integration-nuxt-4/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-nuxt-4/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-nuxt-4/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-nuxt-4/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-nuxt-4/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-nuxt-4/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-python/SKILL.md +8 -13
- package/skills/integration/integration-python/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-python/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-python/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-python/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-python/references/python.md +1 -1
- package/skills/integration/integration-react-native/SKILL.md +8 -9
- package/skills/integration/integration-react-native/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-native/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-native/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-native/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-native/references/react-native-sdk.md +11 -10
- package/skills/integration/integration-react-react-router-6/SKILL.md +6 -12
- package/skills/integration/integration-react-react-router-6/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-react-router-6/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-react-router-6/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-react-router-6/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-react-router-6/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-react-router-6/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-react-router-7-data/SKILL.md +6 -12
- package/skills/integration/integration-react-react-router-7-data/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-react-router-7-data/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-react-router-7-data/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-react-router-7-declarative/SKILL.md +6 -12
- package/skills/integration/integration-react-react-router-7-declarative/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-react-router-7-declarative/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-react-router-7-declarative/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-react-router-7-framework/SKILL.md +6 -12
- package/skills/integration/integration-react-react-router-7-framework/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-react-router-7-framework/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-react-router-7-framework/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-tanstack-router-code-based/SKILL.md +6 -14
- package/skills/integration/integration-react-tanstack-router-code-based/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-tanstack-router-code-based/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-tanstack-router-code-based/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-tanstack-router-file-based/SKILL.md +6 -14
- package/skills/integration/integration-react-tanstack-router-file-based/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-tanstack-router-file-based/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-tanstack-router-file-based/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-react-vite/SKILL.md +6 -12
- package/skills/integration/integration-react-vite/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-react-vite/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-react-vite/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-react-vite/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-react-vite/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-react-vite/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-ruby/SKILL.md +6 -10
- package/skills/integration/integration-ruby/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-ruby/references/analytics.md +1 -1
- package/skills/integration/integration-ruby/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-ruby/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-ruby/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-ruby-on-rails/SKILL.md +5 -14
- package/skills/integration/integration-ruby-on-rails/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-ruby-on-rails/references/analytics.md +1 -1
- package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-sveltekit/SKILL.md +6 -6
- package/skills/integration/integration-sveltekit/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-sveltekit/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-sveltekit/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-sveltekit/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-sveltekit/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-sveltekit/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-swift/SKILL.md +9 -10
- package/skills/integration/integration-swift/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-swift/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-swift/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-swift/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-swift/references/ios.md +1480 -0
- package/skills/integration/integration-tanstack-start/SKILL.md +6 -17
- package/skills/integration/integration-tanstack-start/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-tanstack-start/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-tanstack-start/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-tanstack-start/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-tanstack-start/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-tanstack-start/references/browser-unified-sdk.md +2212 -0
- package/skills/integration/integration-vue-3/SKILL.md +6 -5
- package/skills/integration/integration-vue-3/references/amplitude-quickstart.md +1 -1
- package/skills/integration/integration-vue-3/references/basic-integration-1.0-begin.md +3 -1
- package/skills/integration/integration-vue-3/references/basic-integration-1.1-edit.md +183 -0
- package/skills/integration/integration-vue-3/references/basic-integration-1.3-conclude.md +81 -11
- package/skills/integration/integration-vue-3/references/browser-sdk-2.md +67 -20
- package/skills/integration/integration-vue-3/references/browser-unified-sdk.md +2212 -0
- package/skills/taxonomy/amplitude-chart-dashboard-plan/SKILL.md +183 -0
- package/dist/src/ui/tui/screens/ChecklistScreen.d.ts +0 -12
- package/dist/src/ui/tui/screens/ChecklistScreen.js +0 -111
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: integration-ruby
|
|
3
|
-
description: Amplitude integration for any Ruby application using the
|
|
3
|
+
description: Amplitude integration for any Ruby application using the amplitude-api gem
|
|
4
4
|
metadata:
|
|
5
5
|
author: Amplitude
|
|
6
6
|
version: dev
|
|
@@ -36,15 +36,11 @@ The example project shows the target implementation pattern. Consult the documen
|
|
|
36
36
|
- **Environment variables**: Always use environment variables for Amplitude keys. Never hardcode them.
|
|
37
37
|
- **Minimal changes**: Add Amplitude code alongside existing integrations. Don't replace or restructure existing code.
|
|
38
38
|
- **Match the example**: Your implementation should follow the example project's patterns as closely as possible.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
- Use AmplitudeAPI::Event and AmplitudeAPI.send_event for tracking; initialize with AmplitudeAPI.config.api_key
|
|
44
|
-
- In CLIs and scripts, ensure events are flushed before exit
|
|
45
|
-
- Use begin/rescue/ensure for proper cleanup patterns
|
|
46
|
-
- Events take a user_id and event_type plus event_properties hash
|
|
39
|
+
- **Unified SDK**: For new browser/frontend projects, use `@amplitude/unified` as the default SDK — it bundles Analytics, Session Replay, Experiment, and Guides & Surveys in a single package. Initialize with `initAll()`. Only use `@amplitude/analytics-browser` if the project already has it installed.
|
|
40
|
+
- **Event naming**: Event names MUST use Title Case with spaces following the [Noun] + [Past-Tense Verb] pattern (e.g., "Button Clicked", "Sign Up Completed", "Cart Viewed"). Do NOT use snake_case, camelCase, or SCREAMING_SNAKE. Property names should use snake_case (e.g., button_text, page_url).
|
|
41
|
+
- **No PII in events**: Never send PII (emails, full names, phone numbers, physical addresses, IP addresses) in `track()` event properties. PII belongs in `identify()` user properties only.
|
|
42
|
+
- **Autocapture**: Enable autocapture in the init config to automatically capture sessions, page views, form interactions, and file downloads. Use the `autocapture` config option (not the deprecated `defaultTracking`).
|
|
47
43
|
|
|
48
44
|
## Identifying users
|
|
49
45
|
|
|
50
|
-
Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. Call `amplitude.setUserId(userId)` to associate events with a known user, and use `amplitude.identify()` with an `Identify` object to set user properties. If both frontend and backend code exist, pass a consistent user/device ID via custom request headers to maintain event correlation.
|
|
46
|
+
Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. Call `amplitude.setUserId(userId)` to associate events with a known user, and use `amplitude.identify()` with an `Identify` object to set user properties. Call `amplitude.reset()` on logout to unlink future events from the current user. If both frontend and backend code exist, pass a consistent user/device ID via custom request headers to maintain event correlation.
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
</style>
|
|
83
83
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
|
|
84
|
-
<link href="/docs/css/site.css?id=
|
|
84
|
+
<link href="/docs/css/site.css?id=6e2f9e1efe9343c4ba65666223648444" rel="stylesheet">
|
|
85
85
|
<link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
|
|
86
86
|
<link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
|
|
87
87
|
<style>
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
|
|
77
|
-
<link href="/docs/css/site.css?id=
|
|
77
|
+
<link href="/docs/css/site.css?id=6e2f9e1efe9343c4ba65666223648444" rel="stylesheet">
|
|
78
78
|
<link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
|
|
79
79
|
<link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
|
|
80
80
|
<style>
|
|
@@ -21,7 +21,9 @@ Do not skip server-side events - they capture actions that cannot be tracked cli
|
|
|
21
21
|
|
|
22
22
|
Create a new file with a JSON array at the root of the project: .amplitude-events.json. It should include one object for each event we want to add: event name, event description, and the file path we want to place the event in. If events already exist, don't duplicate them; supplement them.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**Event names MUST use Title Case with spaces** following the [Noun] + [Past-Tense Verb] pattern (e.g., "Button Clicked", "Sign Up Completed", "Cart Viewed"). Do NOT use snake_case (button_clicked), camelCase (buttonClicked), or SCREAMING_SNAKE (BUTTON_CLICKED). Property names should use snake_case (e.g., button_text, page_url).
|
|
25
|
+
|
|
26
|
+
Track actions only, not pageviews. These can be captured automatically via Amplitude's autocapture. Exceptions can be made for "viewed"-type events that correspond to the top of a conversion funnel.
|
|
25
27
|
|
|
26
28
|
As you review files, make an internal note of opportunities to identify users. We'll need them for the next step.
|
|
27
29
|
|
|
@@ -5,8 +5,12 @@ description: Implement Amplitude event tracking in the identified files, followi
|
|
|
5
5
|
|
|
6
6
|
For each of the files and events noted in .amplitude-events.json, make edits to capture events using Amplitude. Make sure to set up any helper files needed. Carefully examine the included example project code: your implementation should match it as closely as possible. Do not spawn subagents.
|
|
7
7
|
|
|
8
|
+
For browser/frontend projects, use @amplitude/unified as the default SDK — it bundles Analytics, Session Replay, and Experiment in a single package. Only use @amplitude/analytics-browser if the project already has it installed.
|
|
9
|
+
|
|
8
10
|
Use environment variables for Amplitude keys. Do not hardcode Amplitude keys.
|
|
9
11
|
|
|
12
|
+
Event names MUST use Title Case with spaces following the [Noun] + [Past-Tense Verb] pattern (e.g., "Button Clicked", "Sign Up Completed", "Cart Viewed"). Do NOT use snake_case or camelCase for event names. Property names should use snake_case (e.g., button_text, page_url).
|
|
13
|
+
|
|
10
14
|
If a file already has existing integration code for other tools or services, don't overwrite or remove that code. Place Amplitude code below it.
|
|
11
15
|
|
|
12
16
|
For each event, add useful properties, and use your access to the Amplitude source code to ensure correctness. You also have access to documentation about creating new events with Amplitude. Consider this documentation carefully and follow it closely before adding events. Your integration should be based on documented best practices. Carefully consider how the user project's framework version may impact the correct Amplitude integration approach.
|
|
@@ -21,6 +25,185 @@ Remember: Do not alter the fundamental architecture of existing files. Make your
|
|
|
21
25
|
|
|
22
26
|
Remember the documentation and example project resources you were provided at the beginning. Read them now.
|
|
23
27
|
|
|
28
|
+
## Framework-specific guidelines
|
|
29
|
+
|
|
30
|
+
Apply **only** the section that matches your active integration skill. Skip all other sections.
|
|
31
|
+
|
|
32
|
+
### React — all variants
|
|
33
|
+
_Applies to: react-vite, react-react-router-6, react-react-router-7-framework, react-react-router-7-data, react-react-router-7-declarative, react-tanstack-router-file-based, react-tanstack-router-code-based, tanstack-start, nextjs-app-router, nextjs-pages-router_
|
|
34
|
+
|
|
35
|
+
- For feature flags, use the Amplitude Experiment React SDK hooks (`useVariantValue`, `useExperiment`) — they handle loading states and async fetch automatically
|
|
36
|
+
- Add analytics track calls in event handlers where user actions occur, NOT in `useEffect` reacting to state changes
|
|
37
|
+
- Do NOT use `useEffect` for data transformation — calculate derived values during render instead
|
|
38
|
+
- Do NOT use `useEffect` to respond to user events — put that logic in the event handler itself
|
|
39
|
+
- Do NOT use `useEffect` to chain state updates — calculate all related updates together in the event handler
|
|
40
|
+
- Do NOT use `useEffect` to notify parent components — call the parent callback alongside `setState` in the event handler
|
|
41
|
+
- To reset component state when a prop changes, pass the prop as the component's `key` instead of using `useEffect`
|
|
42
|
+
- `useEffect` is ONLY for synchronizing with external systems (non-React widgets, browser APIs, network subscriptions)
|
|
43
|
+
|
|
44
|
+
### Next.js (in addition to React guidelines above)
|
|
45
|
+
_Applies to: nextjs-app-router, nextjs-pages-router_
|
|
46
|
+
|
|
47
|
+
- For Next.js 15.3+, initialize Amplitude in `instrumentation-client.ts` for the simplest setup
|
|
48
|
+
|
|
49
|
+
### TanStack Router / TanStack Start (in addition to React guidelines above)
|
|
50
|
+
_Applies to: react-tanstack-router-file-based, react-tanstack-router-code-based, tanstack-start_
|
|
51
|
+
|
|
52
|
+
- Use TanStack Router's built-in navigation events for pageview tracking instead of `useEffect`
|
|
53
|
+
- Initialize Amplitude once in the root component — `__root.tsx` (file-based) or wherever `createRootRoute()` is called (code-based)
|
|
54
|
+
|
|
55
|
+
### TanStack Start (in addition to React and TanStack Router guidelines above)
|
|
56
|
+
_Applies to: tanstack-start_
|
|
57
|
+
|
|
58
|
+
- Use `@amplitude/analytics-node` for server-side event tracking in API routes (`src/routes/api/`) — do NOT use `@amplitude/analytics-browser` on the server
|
|
59
|
+
- Create a singleton Amplitude server client to avoid re-initialization on every request
|
|
60
|
+
|
|
61
|
+
### Angular
|
|
62
|
+
_Applies to: angular_
|
|
63
|
+
|
|
64
|
+
- Use `inject()` instead of constructor injection for Amplitude in components and services
|
|
65
|
+
- Create a dedicated `AmplitudeService` as a singleton root service that wraps the SDK
|
|
66
|
+
- Always use standalone components over NgModules
|
|
67
|
+
- Configure Amplitude credentials in `src/environments/environment.ts` — Angular reads env vars from these config files, not from `process.env`
|
|
68
|
+
|
|
69
|
+
### SvelteKit
|
|
70
|
+
_Applies to: sveltekit_
|
|
71
|
+
|
|
72
|
+
- Set `paths.relative = false` in `svelte.config.js` if needed for client-side SDK compatibility with SSR
|
|
73
|
+
- Use the Svelte MCP server tools to check Svelte documentation (`list-sections`, `get-documentation`) and validate components (`svelte-autofixer`) — run `svelte-autofixer` on every new or modified `.svelte` file before finishing
|
|
74
|
+
|
|
75
|
+
### Astro — all variants
|
|
76
|
+
_Applies to: astro-static, astro-ssr, astro-hybrid, astro-view-transitions_
|
|
77
|
+
|
|
78
|
+
- Always use the `is:inline` directive on Amplitude script tags to prevent Astro from processing them and causing TypeScript errors
|
|
79
|
+
- Use `PUBLIC_` prefix for client-side environment variables (e.g., `PUBLIC_AMPLITUDE_API_KEY`)
|
|
80
|
+
- Create an `amplitude.astro` component in `src/components/` for reusable initialization across pages
|
|
81
|
+
- Import the Amplitude component in a Layout and wrap all pages with that layout
|
|
82
|
+
|
|
83
|
+
### Astro View Transitions (in addition to Astro base guidelines above)
|
|
84
|
+
_Applies to: astro-view-transitions_
|
|
85
|
+
|
|
86
|
+
- Wrap Amplitude initialization with a `window.__amplitude_initialized` guard to prevent re-initialization during soft navigation
|
|
87
|
+
- Use the `astro:page-load` event instead of just `DOMContentLoaded` to re-run scripts after soft navigation
|
|
88
|
+
|
|
89
|
+
### Astro SSR / Hybrid (in addition to Astro base guidelines above)
|
|
90
|
+
_Applies to: astro-ssr, astro-hybrid_
|
|
91
|
+
|
|
92
|
+
- Use `@amplitude/analytics-node` in API routes under `src/pages/api/` for server-side event tracking
|
|
93
|
+
- Store the Amplitude node client as a singleton in `src/lib/amplitude-server.ts` to avoid creating multiple clients
|
|
94
|
+
|
|
95
|
+
### Astro Hybrid (in addition to Astro SSR guidelines above)
|
|
96
|
+
_Applies to: astro-hybrid_
|
|
97
|
+
|
|
98
|
+
- In Astro 5, use `output: static` (the default) with an adapter — pages are prerendered by default
|
|
99
|
+
- Use `export const prerender = false` to opt specific pages into SSR when they need server-side rendering
|
|
100
|
+
- Only pages that need server-side Amplitude tracking (such as API-backed forms) should opt out of prerendering
|
|
101
|
+
|
|
102
|
+
### Python — all variants
|
|
103
|
+
_Applies to: python, django, fastapi, flask_
|
|
104
|
+
|
|
105
|
+
- `amplitude-analytics` is the Python SDK package name
|
|
106
|
+
- Install with `pip install amplitude-analytics` or `pip install -r requirements.txt` — do NOT use unquoted version specifiers like `>=` directly in shell commands
|
|
107
|
+
- Always initialize with `Amplitude(api_key)` and configure via `Config()` — do NOT use module-level config
|
|
108
|
+
- In CLIs and scripts: MUST call `client.shutdown()` before exit or all events are lost. Register it with `atexit.register(client.shutdown)` to flush on exit.
|
|
109
|
+
- NEVER send PII in `track()` event properties (no emails, names, phone numbers, addresses, IPs, or user content). PII belongs in `identify()` user properties only. Safe event properties are metadata like `message_length`, `form_type`, boolean flags.
|
|
110
|
+
- Source code for the SDK is available in the `venv/site-packages` directory
|
|
111
|
+
|
|
112
|
+
### Django (in addition to Python guidelines above)
|
|
113
|
+
_Applies to: django_
|
|
114
|
+
|
|
115
|
+
- Initialize the Amplitude client in `AppConfig.ready()` with the API key from environment variables
|
|
116
|
+
- Use a singleton pattern — create the client once and reuse it across requests
|
|
117
|
+
|
|
118
|
+
### FastAPI (in addition to Python guidelines above)
|
|
119
|
+
_Applies to: fastapi_
|
|
120
|
+
|
|
121
|
+
- Initialize Amplitude in the `lifespan` context manager on startup; call `await amplitude.flush()` on shutdown
|
|
122
|
+
- Use Pydantic Settings with `@lru_cache` on `get_settings()` for caching and easy test overrides
|
|
123
|
+
- Use FastAPI dependency injection (`Depends`) for accessing `current_user` and settings in route handlers
|
|
124
|
+
|
|
125
|
+
### Flask (in addition to Python guidelines above)
|
|
126
|
+
_Applies to: flask_
|
|
127
|
+
|
|
128
|
+
- Initialize Amplitude globally in `create_app()` (NOT per-request)
|
|
129
|
+
- Blueprint registration happens AFTER Amplitude initialization in `create_app()`
|
|
130
|
+
|
|
131
|
+
### JavaScript Node
|
|
132
|
+
_Applies to: javascript_node_
|
|
133
|
+
|
|
134
|
+
- `@amplitude/analytics-node` is the server-side SDK — do NOT use `@amplitude/analytics-browser` on the server
|
|
135
|
+
- Track events in route handlers for meaningful user actions; every route that creates, updates, or deletes data should track an event
|
|
136
|
+
- In long-running servers the SDK batches automatically — do NOT set `flushQueueSize` or `flushIntervalMillis` unless you have a specific reason
|
|
137
|
+
- For short-lived processes (scripts, CLIs, serverless): call `await amplitude.flush()` before exit
|
|
138
|
+
- Reverse proxy is NOT needed for server-side Node.js — only client-side JS may benefit from one to avoid ad blockers
|
|
139
|
+
- Source code is available in the `node_modules` directory
|
|
140
|
+
|
|
141
|
+
### JavaScript Web
|
|
142
|
+
_Applies to: javascript_web_
|
|
143
|
+
|
|
144
|
+
- `@amplitude/analytics-browser` is the browser SDK — do NOT import it in Node.js or server-side contexts
|
|
145
|
+
- `amplitude.init()` MUST be called before any other Amplitude methods
|
|
146
|
+
- Autocapture is available via the autocapture plugin but is NOT enabled by default — opt in explicitly if requested
|
|
147
|
+
- Call `amplitude.reset()` on logout to unlink future events from the current user
|
|
148
|
+
- For SPAs without a framework router, use the `pageViewTracking` option in `amplitude.init()` or manually call `amplitude.track('Page Viewed', { path })` for History API routing
|
|
149
|
+
|
|
150
|
+
### Android
|
|
151
|
+
_Applies to: android_
|
|
152
|
+
|
|
153
|
+
- Adapt dependency configuration to the appropriate `build.gradle(.kts)` file for the project's Gradle version
|
|
154
|
+
- Initialize Amplitude in the `Application` class's `onCreate()`: `Amplitude(Configuration(apiKey = ..., context = applicationContext)).also { amplitude = it }` — call this only once
|
|
155
|
+
- Ensure every activity has an `android:label` to accurately track screen views
|
|
156
|
+
|
|
157
|
+
### Swift
|
|
158
|
+
_Applies to: swift_
|
|
159
|
+
|
|
160
|
+
- Read configuration from environment variables via a dedicated enum using `ProcessInfo.processInfo.environment`; fatalError if `AMPLITUDE_API_KEY` is missing
|
|
161
|
+
- When adding SPM dependencies to `project.pbxproj`, create three distinct objects with unique UUIDs: a `PBXBuildFile` (with `productRef`), an `XCSwiftPackageProductDependency` (with `package` and `productName`), and an `XCRemoteSwiftPackageReference` (with `repositoryURL` and `requirement`)
|
|
162
|
+
- Check the latest release at https://github.com/amplitude/Amplitude-Swift/releases before setting `minimumVersion` — do not hardcode a stale version
|
|
163
|
+
- For macOS with App Sandbox: add `ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES` to build settings — do NOT disable the sandbox
|
|
164
|
+
|
|
165
|
+
### React Native
|
|
166
|
+
_Applies to: react-native_
|
|
167
|
+
|
|
168
|
+
- `@amplitude/analytics-react-native` is the SDK package name
|
|
169
|
+
- Use `react-native-config` to load `AMPLITUDE_API_KEY` from `.env` (embedded at build time, not runtime)
|
|
170
|
+
- Requires `@react-native-async-storage/async-storage` and `@react-native-community/netinfo` as peer dependencies — install them alongside the SDK
|
|
171
|
+
- Initialize Amplitude once at the top level (e.g., `App.tsx`) before any track calls
|
|
172
|
+
|
|
173
|
+
### Expo
|
|
174
|
+
_Applies to: expo_
|
|
175
|
+
|
|
176
|
+
- `@amplitude/analytics-react-native` is the SDK package name (same as bare RN)
|
|
177
|
+
- Use `expo-constants` with `app.config.js` extras for `AMPLITUDE_API_KEY` (NOT `react-native-config`)
|
|
178
|
+
- Access it via `Constants.expoConfig?.extra?.amplitudeApiKey`
|
|
179
|
+
- For `expo-router`, initialize Amplitude in `app/_layout.tsx` and track screen views manually: `amplitude.track('Screen Viewed', { screen: pathname })`
|
|
180
|
+
- Requires `@react-native-async-storage/async-storage` and `@react-native-community/netinfo` as peer dependencies
|
|
181
|
+
|
|
182
|
+
### Ruby
|
|
183
|
+
_Applies to: ruby, ruby-on-rails_
|
|
184
|
+
|
|
185
|
+
- `amplitude-api` gem (`gem 'amplitude-api'` in Gemfile)
|
|
186
|
+
- Use `AmplitudeAPI::Event` and `AmplitudeAPI.send_event`; initialize with `AmplitudeAPI.config.api_key`
|
|
187
|
+
- Events take `user_id`, `event_type`, and `event_properties` hash
|
|
188
|
+
- Ensure events are flushed before exit; use `begin/rescue/ensure` for cleanup
|
|
189
|
+
|
|
190
|
+
### Ruby on Rails (in addition to Ruby guidelines above)
|
|
191
|
+
_Applies to: ruby-on-rails_
|
|
192
|
+
|
|
193
|
+
- Initialize AmplitudeAPI in `config/initializers/amplitude.rb`
|
|
194
|
+
- Create a dedicated service class for Amplitude tracking to keep controllers clean
|
|
195
|
+
- Use background jobs for non-critical tracking to avoid slowing down request handling
|
|
196
|
+
|
|
197
|
+
### Laravel
|
|
198
|
+
_Applies to: laravel_
|
|
199
|
+
|
|
200
|
+
- Create a dedicated `AmplitudeService` in `app/Services/` — do NOT scatter track calls throughout controllers
|
|
201
|
+
- Register Amplitude config in `config/amplitude.php` using `env()` for all settings
|
|
202
|
+
- Do NOT use Laravel's event system or observers for analytics — call track explicitly where actions occur
|
|
203
|
+
- `amplitude/amplitude-php` is the PHP SDK package (community gem — check `composer.json` for availability)
|
|
204
|
+
- Source code is available in the `vendor` directory after `composer install`
|
|
205
|
+
- Initialize the Amplitude client once with your API key and reuse it throughout the application
|
|
206
|
+
|
|
24
207
|
## Status
|
|
25
208
|
|
|
26
209
|
Status to report in this phase:
|
|
@@ -7,21 +7,83 @@ description: Review and finalize the Amplitude integration implementation
|
|
|
7
7
|
|
|
8
8
|
Before anything else, verify that the Amplitude environment variables are properly set up for production.
|
|
9
9
|
|
|
10
|
-
1. Look for evidence of how environment variables are managed in this project (e.g., `.env`, `.env.local`, `.env.example`, `vercel.json`,
|
|
10
|
+
1. Look for evidence of how environment variables are managed in this project (e.g., `.env`, `.env.local`, `.env.example`, `vercel.json`, platform-specific config files, CI/CD config).
|
|
11
11
|
2. Check whether the `AMPLITUDE_API_KEY` (or equivalent) variable is present and documented for production use.
|
|
12
12
|
3. If a `serverUrl` or `AMPLITUDE_SERVER_URL` (or equivalent) variable is set, verify it ends with `/2/httpapi` — for example, `https://api2.amplitude.com/2/httpapi`. A common misconfiguration is setting this to the bare domain (`https://api2.amplitude.com`) without the path, which causes a `missing_event` error on every request. Fix this if found.
|
|
13
13
|
|
|
14
|
-
If you can clearly identify the deployment platform
|
|
14
|
+
If you can clearly identify the deployment platform, add a note to the report with the exact steps to configure the environment variable on that platform.
|
|
15
15
|
|
|
16
|
-
**If the deployment environment cannot be determined, or the variable is missing or misconfigured:** hardcode the Amplitude API key directly in the initialization code as a fallback. Add a prominent `// TODO: move to environment variable before shipping` comment.
|
|
16
|
+
**If the deployment environment cannot be determined, or the variable is missing or misconfigured:** hardcode the Amplitude API key directly in the initialization code as a fallback. Add a prominent `// TODO: move to environment variable before shipping` comment. Call this out clearly in the report's Next steps section.
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## Chart and dashboard creation (REQUIRED)
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
This step is **mandatory**. Do not skip it. Use the Amplitude MCP to create a dashboard and supporting charts for this project.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### Step 1 — Load the chart/dashboard planning skill
|
|
25
|
+
|
|
26
|
+
Load the **`amplitude-chart-dashboard-plan`** skill (taxonomy category via wizard-tools). Follow its guidance for all decisions in this section.
|
|
27
|
+
|
|
28
|
+
### Step 2 — Read the event plan
|
|
29
|
+
|
|
30
|
+
Search for and read `.amplitude-events.json`. This file lists every event that was instrumented. Use the exact event names from this file — do not normalize or rename them.
|
|
31
|
+
|
|
32
|
+
### Step 3 — Identify product funnels from the instrumented events
|
|
33
|
+
|
|
34
|
+
Group the events into 2–5 product funnels. Examples:
|
|
35
|
+
- **Onboarding**: sign-up → first action → activation
|
|
36
|
+
- **Core loop**: primary value action and its supporting events
|
|
37
|
+
- **Conversion**: checkout, upgrade, or subscribe flow
|
|
38
|
+
- **Retention**: events that indicate a returning user is re-engaging
|
|
39
|
+
|
|
40
|
+
If Autocapture is enabled (web apps), note that `[Amplitude] Page Viewed` and `[Amplitude] Element Clicked` are available automatically even before custom events fire.
|
|
41
|
+
|
|
42
|
+
### Step 4 — Plan the charts (before creating them)
|
|
43
|
+
|
|
44
|
+
Following the `amplitude-chart-dashboard-plan` skill, plan up to 8 charts:
|
|
45
|
+
|
|
46
|
+
- **1 funnel chart per product funnel** (2–5 charts) — conversion-oriented, all steps in order
|
|
47
|
+
- **1–2 volume/trend charts** — daily uniques for the most critical events
|
|
48
|
+
- **1–2 Autocapture charts** — top pages by volume (`[Amplitude] Page Viewed`), plus element clicks for web apps
|
|
49
|
+
- **1 retention chart** — N-day retention anchored on the most important activation event
|
|
50
|
+
|
|
51
|
+
### Step 5 — Create the charts via Amplitude MCP
|
|
52
|
+
|
|
53
|
+
Use the Amplitude MCP to create each chart in the plan. Collect the returned chart IDs.
|
|
54
|
+
|
|
55
|
+
### Step 6 — Create the dashboard
|
|
56
|
+
|
|
57
|
+
Create a single dashboard using the Amplitude MCP with:
|
|
58
|
+
- **Name**: `"[Product Name] Analytics — [Year]"` — use the product/app name from package.json or the app's title if available; fall back to `"Analytics Dashboard — [Year]"`
|
|
59
|
+
- **Description**: `"Auto-generated by the Amplitude Wizard. Autocapture charts (page views, clicks) populate immediately. Custom event charts populate once those user flows are triggered."`
|
|
60
|
+
- **Charts**: all chart IDs collected in Step 5, organized into sections by funnel (Acquisition → Activation → Core Loop → Conversion → Retention)
|
|
61
|
+
|
|
62
|
+
### Step 7 — Write `.amplitude-dashboard.json`
|
|
63
|
+
|
|
64
|
+
After the dashboard is created, write a file `.amplitude-dashboard.json` in the project root:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"dashboardUrl": "<dashboard URL from MCP response>",
|
|
69
|
+
"dashboardId": "<dashboard ID>",
|
|
70
|
+
"charts": [
|
|
71
|
+
{ "id": "<chart-id>", "title": "<chart title>", "type": "<funnel|line|retention>", "funnel": "<funnel name>" }
|
|
72
|
+
],
|
|
73
|
+
"createdAt": "<ISO timestamp>"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Setup report
|
|
80
|
+
|
|
81
|
+
Create the file `amplitude-setup-report.md`. Include:
|
|
82
|
+
- A summary of the integration edits
|
|
83
|
+
- A table with event names, descriptions, and files where events were added
|
|
84
|
+
- A list of the charts and dashboard created (with direct links)
|
|
85
|
+
|
|
86
|
+
Follow this format:
|
|
25
87
|
|
|
26
88
|
<wizard-report>
|
|
27
89
|
# Amplitude post-wizard report
|
|
@@ -30,11 +92,19 @@ The wizard has completed a deep integration of your project. [Detailed summary o
|
|
|
30
92
|
|
|
31
93
|
[table of events/descriptions/files]
|
|
32
94
|
|
|
33
|
-
##
|
|
95
|
+
## Analytics dashboard
|
|
96
|
+
|
|
97
|
+
We've built a dashboard and [N] charts tied to your product flows:
|
|
34
98
|
|
|
35
|
-
|
|
99
|
+
[links to dashboard and individual charts]
|
|
36
100
|
|
|
37
|
-
|
|
101
|
+
The following charts use Autocapture and will populate as soon as any user visits the app (no additional instrumentation required):
|
|
102
|
+
- [list Autocapture charts]
|
|
103
|
+
|
|
104
|
+
The following charts rely on custom events and will populate once those flows are triggered:
|
|
105
|
+
- [list custom event charts]
|
|
106
|
+
|
|
107
|
+
## Next steps
|
|
38
108
|
|
|
39
109
|
### Environment variable configuration
|
|
40
110
|
|
|
@@ -42,11 +112,11 @@ We've built some insights and a dashboard for you to keep an eye on user behavio
|
|
|
42
112
|
|
|
43
113
|
### Agent skill
|
|
44
114
|
|
|
45
|
-
We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code.
|
|
115
|
+
We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code.
|
|
46
116
|
|
|
47
117
|
</wizard-report>
|
|
48
118
|
|
|
49
|
-
Upon completion, remove
|
|
119
|
+
Upon completion, remove `.amplitude-events.json` and `.amplitude-dashboard.json`.
|
|
50
120
|
|
|
51
121
|
## Status
|
|
52
122
|
|
|
@@ -36,20 +36,11 @@ The example project shows the target implementation pattern. Consult the documen
|
|
|
36
36
|
- **Environment variables**: Always use environment variables for Amplitude keys. Never hardcode them.
|
|
37
37
|
- **Minimal changes**: Add Amplitude code alongside existing integrations. Don't replace or restructure existing code.
|
|
38
38
|
- **Match the example**: Your implementation should follow the example project's patterns as closely as possible.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- Use the
|
|
43
|
-
- Initialize AmplitudeAPI with your API key in config/initializers/amplitude.rb
|
|
44
|
-
- Create a dedicated service class for Amplitude tracking to keep controllers clean
|
|
45
|
-
- Use background jobs for non-critical tracking to avoid slowing down requests
|
|
46
|
-
- Store API key in Rails credentials or environment variables, never hardcode
|
|
47
|
-
- amplitude-api is a commonly used Ruby SDK gem (add `gem 'amplitude-api'` to Gemfile)
|
|
48
|
-
- Use AmplitudeAPI::Event and AmplitudeAPI.send_event for tracking; initialize with AmplitudeAPI.config.api_key
|
|
49
|
-
- In CLIs and scripts, ensure events are flushed before exit
|
|
50
|
-
- Use begin/rescue/ensure for proper cleanup patterns
|
|
51
|
-
- Events take a user_id and event_type plus event_properties hash
|
|
39
|
+
- **Unified SDK**: For new browser/frontend projects, use `@amplitude/unified` as the default SDK — it bundles Analytics, Session Replay, Experiment, and Guides & Surveys in a single package. Initialize with `initAll()`. Only use `@amplitude/analytics-browser` if the project already has it installed.
|
|
40
|
+
- **Event naming**: Event names MUST use Title Case with spaces following the [Noun] + [Past-Tense Verb] pattern (e.g., "Button Clicked", "Sign Up Completed", "Cart Viewed"). Do NOT use snake_case, camelCase, or SCREAMING_SNAKE. Property names should use snake_case (e.g., button_text, page_url).
|
|
41
|
+
- **No PII in events**: Never send PII (emails, full names, phone numbers, physical addresses, IP addresses) in `track()` event properties. PII belongs in `identify()` user properties only.
|
|
42
|
+
- **Autocapture**: Enable autocapture in the init config to automatically capture sessions, page views, form interactions, and file downloads. Use the `autocapture` config option (not the deprecated `defaultTracking`).
|
|
52
43
|
|
|
53
44
|
## Identifying users
|
|
54
45
|
|
|
55
|
-
Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. Call `amplitude.setUserId(userId)` to associate events with a known user, and use `amplitude.identify()` with an `Identify` object to set user properties. If both frontend and backend code exist, pass a consistent user/device ID via custom request headers to maintain event correlation.
|
|
46
|
+
Identify users during login and signup events. Refer to the example code and documentation for the correct identify pattern for this framework. Call `amplitude.setUserId(userId)` to associate events with a known user, and use `amplitude.identify()` with an `Identify` object to set user properties. Call `amplitude.reset()` on logout to unlink future events from the current user. If both frontend and backend code exist, pass a consistent user/device ID via custom request headers to maintain event correlation.
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
}
|
|
82
82
|
</style>
|
|
83
83
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
|
|
84
|
-
<link href="/docs/css/site.css?id=
|
|
84
|
+
<link href="/docs/css/site.css?id=6e2f9e1efe9343c4ba65666223648444" rel="stylesheet">
|
|
85
85
|
<link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
|
|
86
86
|
<link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
|
|
87
87
|
<style>
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
|
|
77
|
-
<link href="/docs/css/site.css?id=
|
|
77
|
+
<link href="/docs/css/site.css?id=6e2f9e1efe9343c4ba65666223648444" rel="stylesheet">
|
|
78
78
|
<link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
|
|
79
79
|
<link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
|
|
80
80
|
<style>
|
package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.0-begin.md
CHANGED
|
@@ -21,7 +21,9 @@ Do not skip server-side events - they capture actions that cannot be tracked cli
|
|
|
21
21
|
|
|
22
22
|
Create a new file with a JSON array at the root of the project: .amplitude-events.json. It should include one object for each event we want to add: event name, event description, and the file path we want to place the event in. If events already exist, don't duplicate them; supplement them.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**Event names MUST use Title Case with spaces** following the [Noun] + [Past-Tense Verb] pattern (e.g., "Button Clicked", "Sign Up Completed", "Cart Viewed"). Do NOT use snake_case (button_clicked), camelCase (buttonClicked), or SCREAMING_SNAKE (BUTTON_CLICKED). Property names should use snake_case (e.g., button_text, page_url).
|
|
25
|
+
|
|
26
|
+
Track actions only, not pageviews. These can be captured automatically via Amplitude's autocapture. Exceptions can be made for "viewed"-type events that correspond to the top of a conversion funnel.
|
|
25
27
|
|
|
26
28
|
As you review files, make an internal note of opportunities to identify users. We'll need them for the next step.
|
|
27
29
|
|