@amplitude/wizard 1.1.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.
Files changed (259) hide show
  1. package/dist/bin.js +47 -11
  2. package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.js +11 -1
  3. package/dist/src/frameworks/react-router/react-router-wizard-agent.js +65 -8
  4. package/dist/src/frameworks/vue/vue-wizard-agent.js +6 -1
  5. package/dist/src/lib/agent-interface.js +46 -0
  6. package/dist/src/lib/agent-runner.js +112 -51
  7. package/dist/src/lib/api.d.ts +35 -0
  8. package/dist/src/lib/api.js +118 -0
  9. package/dist/src/lib/commandments.js +1 -0
  10. package/dist/src/lib/constants.d.ts +1 -1
  11. package/dist/src/lib/constants.js +1 -1
  12. package/dist/src/lib/credential-resolution.js +7 -0
  13. package/dist/src/lib/framework-config.d.ts +9 -0
  14. package/dist/src/lib/mcp-with-fallback.d.ts +43 -0
  15. package/dist/src/lib/mcp-with-fallback.js +220 -0
  16. package/dist/src/lib/version-check.d.ts +17 -0
  17. package/dist/src/lib/version-check.js +72 -0
  18. package/dist/src/lib/wizard-session.d.ts +22 -7
  19. package/dist/src/lib/wizard-session.js +5 -3
  20. package/dist/src/run.d.ts +18 -1
  21. package/dist/src/run.js +104 -15
  22. package/dist/src/ui/agent-ui.d.ts +2 -0
  23. package/dist/src/ui/agent-ui.js +10 -0
  24. package/dist/src/ui/logging-ui.d.ts +2 -0
  25. package/dist/src/ui/logging-ui.js +6 -0
  26. package/dist/src/ui/tui/components/ConsoleView.js +14 -1
  27. package/dist/src/ui/tui/components/JourneyStepper.js +1 -3
  28. package/dist/src/ui/tui/flows.d.ts +0 -1
  29. package/dist/src/ui/tui/flows.js +1 -9
  30. package/dist/src/ui/tui/ink-ui.d.ts +2 -0
  31. package/dist/src/ui/tui/ink-ui.js +6 -0
  32. package/dist/src/ui/tui/screen-registry.js +0 -2
  33. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.d.ts +5 -3
  34. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.js +124 -4
  35. package/dist/src/ui/tui/screens/OutroScreen.js +12 -3
  36. package/dist/src/ui/tui/store.d.ts +22 -3
  37. package/dist/src/ui/tui/store.js +52 -18
  38. package/dist/src/ui/tui/utils/diagnostics.js +1 -3
  39. package/dist/src/ui/wizard-ui.d.ts +8 -0
  40. package/dist/src/utils/analytics.d.ts +15 -0
  41. package/dist/src/utils/analytics.js +37 -0
  42. package/dist/src/utils/setup-utils.js +6 -1
  43. package/package.json +2 -2
  44. package/skills/integration/integration-android/SKILL.md +7 -10
  45. package/skills/integration/integration-android/references/amplitude-quickstart.md +1 -1
  46. package/skills/integration/integration-android/references/android.md +1468 -0
  47. package/skills/integration/integration-android/references/basic-integration-1.0-begin.md +3 -1
  48. package/skills/integration/integration-android/references/basic-integration-1.1-edit.md +183 -0
  49. package/skills/integration/integration-android/references/basic-integration-1.3-conclude.md +81 -11
  50. package/skills/integration/integration-angular/SKILL.md +6 -8
  51. package/skills/integration/integration-angular/references/amplitude-quickstart.md +1 -1
  52. package/skills/integration/integration-angular/references/basic-integration-1.0-begin.md +3 -1
  53. package/skills/integration/integration-angular/references/basic-integration-1.1-edit.md +183 -0
  54. package/skills/integration/integration-angular/references/basic-integration-1.3-conclude.md +81 -11
  55. package/skills/integration/integration-angular/references/browser-sdk-2.md +67 -20
  56. package/skills/integration/{integration-swift/references/analytics.md → integration-angular/references/browser-unified-sdk.md} +591 -157
  57. package/skills/integration/integration-astro-hybrid/SKILL.md +6 -13
  58. package/skills/integration/integration-astro-hybrid/references/amplitude-quickstart.md +1 -1
  59. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.0-begin.md +3 -1
  60. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.1-edit.md +183 -0
  61. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.3-conclude.md +81 -11
  62. package/skills/integration/integration-astro-hybrid/references/browser-sdk-2.md +67 -20
  63. package/skills/integration/{integration-android/references/analytics.md → integration-astro-hybrid/references/browser-unified-sdk.md} +591 -157
  64. package/skills/integration/integration-astro-ssr/SKILL.md +6 -11
  65. package/skills/integration/integration-astro-ssr/references/amplitude-quickstart.md +1 -1
  66. package/skills/integration/integration-astro-ssr/references/basic-integration-1.0-begin.md +3 -1
  67. package/skills/integration/integration-astro-ssr/references/basic-integration-1.1-edit.md +183 -0
  68. package/skills/integration/integration-astro-ssr/references/basic-integration-1.3-conclude.md +81 -11
  69. package/skills/integration/integration-astro-ssr/references/browser-sdk-2.md +67 -20
  70. package/skills/integration/{integration-javascript_node/references/analytics.md → integration-astro-ssr/references/browser-unified-sdk.md} +591 -157
  71. package/skills/integration/integration-astro-static/SKILL.md +6 -8
  72. package/skills/integration/integration-astro-static/references/amplitude-quickstart.md +1 -1
  73. package/skills/integration/integration-astro-static/references/basic-integration-1.0-begin.md +3 -1
  74. package/skills/integration/integration-astro-static/references/basic-integration-1.1-edit.md +183 -0
  75. package/skills/integration/integration-astro-static/references/basic-integration-1.3-conclude.md +81 -11
  76. package/skills/integration/integration-astro-static/references/browser-sdk-2.md +67 -20
  77. package/skills/integration/integration-astro-static/references/browser-unified-sdk.md +2212 -0
  78. package/skills/integration/integration-astro-view-transitions/SKILL.md +6 -10
  79. package/skills/integration/integration-astro-view-transitions/references/amplitude-quickstart.md +1 -1
  80. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.0-begin.md +3 -1
  81. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.1-edit.md +183 -0
  82. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.3-conclude.md +81 -11
  83. package/skills/integration/integration-astro-view-transitions/references/browser-sdk-2.md +67 -20
  84. package/skills/integration/integration-astro-view-transitions/references/browser-unified-sdk.md +2212 -0
  85. package/skills/integration/integration-django/SKILL.md +5 -16
  86. package/skills/integration/integration-django/references/amplitude-quickstart.md +1 -1
  87. package/skills/integration/integration-django/references/basic-integration-1.0-begin.md +3 -1
  88. package/skills/integration/integration-django/references/basic-integration-1.1-edit.md +183 -0
  89. package/skills/integration/integration-django/references/basic-integration-1.3-conclude.md +81 -11
  90. package/skills/integration/integration-django/references/python.md +1 -1
  91. package/skills/integration/integration-expo/SKILL.md +8 -13
  92. package/skills/integration/integration-expo/references/amplitude-quickstart.md +1 -1
  93. package/skills/integration/integration-expo/references/basic-integration-1.0-begin.md +3 -1
  94. package/skills/integration/integration-expo/references/basic-integration-1.1-edit.md +183 -0
  95. package/skills/integration/integration-expo/references/basic-integration-1.3-conclude.md +81 -11
  96. package/skills/integration/integration-expo/references/react-native-sdk.md +11 -10
  97. package/skills/integration/integration-fastapi/SKILL.md +5 -16
  98. package/skills/integration/integration-fastapi/references/amplitude-quickstart.md +1 -1
  99. package/skills/integration/integration-fastapi/references/basic-integration-1.0-begin.md +3 -1
  100. package/skills/integration/integration-fastapi/references/basic-integration-1.1-edit.md +183 -0
  101. package/skills/integration/integration-fastapi/references/basic-integration-1.3-conclude.md +81 -11
  102. package/skills/integration/integration-fastapi/references/python.md +1 -1
  103. package/skills/integration/integration-flask/SKILL.md +5 -15
  104. package/skills/integration/integration-flask/references/amplitude-quickstart.md +1 -1
  105. package/skills/integration/integration-flask/references/basic-integration-1.0-begin.md +3 -1
  106. package/skills/integration/integration-flask/references/basic-integration-1.1-edit.md +183 -0
  107. package/skills/integration/integration-flask/references/basic-integration-1.3-conclude.md +81 -11
  108. package/skills/integration/integration-flask/references/python.md +1 -1
  109. package/skills/integration/integration-javascript_node/SKILL.md +6 -12
  110. package/skills/integration/integration-javascript_node/references/amplitude-quickstart.md +1 -1
  111. package/skills/integration/integration-javascript_node/references/basic-integration-1.0-begin.md +3 -1
  112. package/skills/integration/integration-javascript_node/references/basic-integration-1.1-edit.md +183 -0
  113. package/skills/integration/integration-javascript_node/references/basic-integration-1.3-conclude.md +81 -11
  114. package/skills/integration/integration-javascript_node/references/node.md +1457 -0
  115. package/skills/integration/integration-javascript_web/SKILL.md +7 -16
  116. package/skills/integration/integration-javascript_web/references/amplitude-quickstart.md +1 -1
  117. package/skills/integration/integration-javascript_web/references/basic-integration-1.0-begin.md +3 -1
  118. package/skills/integration/integration-javascript_web/references/basic-integration-1.1-edit.md +183 -0
  119. package/skills/integration/integration-javascript_web/references/basic-integration-1.3-conclude.md +81 -11
  120. package/skills/integration/integration-javascript_web/references/browser-sdk-2.md +67 -20
  121. package/skills/integration/integration-javascript_web/references/browser-unified-sdk.md +2212 -0
  122. package/skills/integration/integration-laravel/SKILL.md +5 -11
  123. package/skills/integration/integration-laravel/references/amplitude-quickstart.md +1 -1
  124. package/skills/integration/integration-laravel/references/analytics.md +1 -1
  125. package/skills/integration/integration-laravel/references/basic-integration-1.0-begin.md +3 -1
  126. package/skills/integration/integration-laravel/references/basic-integration-1.1-edit.md +183 -0
  127. package/skills/integration/integration-laravel/references/basic-integration-1.3-conclude.md +81 -11
  128. package/skills/integration/integration-nextjs-app-router/SKILL.md +6 -13
  129. package/skills/integration/integration-nextjs-app-router/references/amplitude-quickstart.md +1 -1
  130. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.0-begin.md +3 -1
  131. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.1-edit.md +183 -0
  132. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.3-conclude.md +81 -11
  133. package/skills/integration/integration-nextjs-app-router/references/browser-sdk-2.md +67 -20
  134. package/skills/integration/integration-nextjs-app-router/references/browser-unified-sdk.md +2212 -0
  135. package/skills/integration/integration-nextjs-pages-router/SKILL.md +6 -13
  136. package/skills/integration/integration-nextjs-pages-router/references/amplitude-quickstart.md +1 -1
  137. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.0-begin.md +3 -1
  138. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.1-edit.md +183 -0
  139. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.3-conclude.md +81 -11
  140. package/skills/integration/integration-nextjs-pages-router/references/browser-sdk-2.md +67 -20
  141. package/skills/integration/integration-nextjs-pages-router/references/browser-unified-sdk.md +2212 -0
  142. package/skills/integration/integration-nuxt-3.6/SKILL.md +6 -5
  143. package/skills/integration/integration-nuxt-3.6/references/EXAMPLE.md +1 -1
  144. package/skills/integration/integration-nuxt-3.6/references/amplitude-quickstart.md +1 -1
  145. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.0-begin.md +3 -1
  146. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.1-edit.md +183 -0
  147. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.3-conclude.md +81 -11
  148. package/skills/integration/integration-nuxt-3.6/references/browser-sdk-2.md +67 -20
  149. package/skills/integration/integration-nuxt-3.6/references/browser-unified-sdk.md +2212 -0
  150. package/skills/integration/integration-nuxt-4/SKILL.md +6 -5
  151. package/skills/integration/integration-nuxt-4/references/amplitude-quickstart.md +1 -1
  152. package/skills/integration/integration-nuxt-4/references/basic-integration-1.0-begin.md +3 -1
  153. package/skills/integration/integration-nuxt-4/references/basic-integration-1.1-edit.md +183 -0
  154. package/skills/integration/integration-nuxt-4/references/basic-integration-1.3-conclude.md +81 -11
  155. package/skills/integration/integration-nuxt-4/references/browser-sdk-2.md +67 -20
  156. package/skills/integration/integration-nuxt-4/references/browser-unified-sdk.md +2212 -0
  157. package/skills/integration/integration-python/SKILL.md +8 -13
  158. package/skills/integration/integration-python/references/amplitude-quickstart.md +1 -1
  159. package/skills/integration/integration-python/references/basic-integration-1.0-begin.md +3 -1
  160. package/skills/integration/integration-python/references/basic-integration-1.1-edit.md +183 -0
  161. package/skills/integration/integration-python/references/basic-integration-1.3-conclude.md +81 -11
  162. package/skills/integration/integration-python/references/python.md +1 -1
  163. package/skills/integration/integration-react-native/SKILL.md +8 -9
  164. package/skills/integration/integration-react-native/references/amplitude-quickstart.md +1 -1
  165. package/skills/integration/integration-react-native/references/basic-integration-1.0-begin.md +3 -1
  166. package/skills/integration/integration-react-native/references/basic-integration-1.1-edit.md +183 -0
  167. package/skills/integration/integration-react-native/references/basic-integration-1.3-conclude.md +81 -11
  168. package/skills/integration/integration-react-native/references/react-native-sdk.md +11 -10
  169. package/skills/integration/integration-react-react-router-6/SKILL.md +6 -12
  170. package/skills/integration/integration-react-react-router-6/references/amplitude-quickstart.md +1 -1
  171. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.0-begin.md +3 -1
  172. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.1-edit.md +183 -0
  173. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.3-conclude.md +81 -11
  174. package/skills/integration/integration-react-react-router-6/references/browser-sdk-2.md +67 -20
  175. package/skills/integration/integration-react-react-router-6/references/browser-unified-sdk.md +2212 -0
  176. package/skills/integration/integration-react-react-router-7-data/SKILL.md +6 -12
  177. package/skills/integration/integration-react-react-router-7-data/references/amplitude-quickstart.md +1 -1
  178. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.0-begin.md +3 -1
  179. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.1-edit.md +183 -0
  180. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.3-conclude.md +81 -11
  181. package/skills/integration/integration-react-react-router-7-data/references/browser-sdk-2.md +67 -20
  182. package/skills/integration/integration-react-react-router-7-data/references/browser-unified-sdk.md +2212 -0
  183. package/skills/integration/integration-react-react-router-7-declarative/SKILL.md +6 -12
  184. package/skills/integration/integration-react-react-router-7-declarative/references/amplitude-quickstart.md +1 -1
  185. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.0-begin.md +3 -1
  186. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.1-edit.md +183 -0
  187. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.3-conclude.md +81 -11
  188. package/skills/integration/integration-react-react-router-7-declarative/references/browser-sdk-2.md +67 -20
  189. package/skills/integration/integration-react-react-router-7-declarative/references/browser-unified-sdk.md +2212 -0
  190. package/skills/integration/integration-react-react-router-7-framework/SKILL.md +6 -12
  191. package/skills/integration/integration-react-react-router-7-framework/references/amplitude-quickstart.md +1 -1
  192. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.0-begin.md +3 -1
  193. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.1-edit.md +183 -0
  194. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.3-conclude.md +81 -11
  195. package/skills/integration/integration-react-react-router-7-framework/references/browser-sdk-2.md +67 -20
  196. package/skills/integration/integration-react-react-router-7-framework/references/browser-unified-sdk.md +2212 -0
  197. package/skills/integration/integration-react-tanstack-router-code-based/SKILL.md +6 -14
  198. package/skills/integration/integration-react-tanstack-router-code-based/references/amplitude-quickstart.md +1 -1
  199. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.0-begin.md +3 -1
  200. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.1-edit.md +183 -0
  201. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.3-conclude.md +81 -11
  202. package/skills/integration/integration-react-tanstack-router-code-based/references/browser-sdk-2.md +67 -20
  203. package/skills/integration/integration-react-tanstack-router-code-based/references/browser-unified-sdk.md +2212 -0
  204. package/skills/integration/integration-react-tanstack-router-file-based/SKILL.md +6 -14
  205. package/skills/integration/integration-react-tanstack-router-file-based/references/amplitude-quickstart.md +1 -1
  206. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.0-begin.md +3 -1
  207. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.1-edit.md +183 -0
  208. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.3-conclude.md +81 -11
  209. package/skills/integration/integration-react-tanstack-router-file-based/references/browser-sdk-2.md +67 -20
  210. package/skills/integration/integration-react-tanstack-router-file-based/references/browser-unified-sdk.md +2212 -0
  211. package/skills/integration/integration-react-vite/SKILL.md +6 -12
  212. package/skills/integration/integration-react-vite/references/amplitude-quickstart.md +1 -1
  213. package/skills/integration/integration-react-vite/references/basic-integration-1.0-begin.md +3 -1
  214. package/skills/integration/integration-react-vite/references/basic-integration-1.1-edit.md +183 -0
  215. package/skills/integration/integration-react-vite/references/basic-integration-1.3-conclude.md +81 -11
  216. package/skills/integration/integration-react-vite/references/browser-sdk-2.md +67 -20
  217. package/skills/integration/integration-react-vite/references/browser-unified-sdk.md +2212 -0
  218. package/skills/integration/integration-ruby/SKILL.md +6 -10
  219. package/skills/integration/integration-ruby/references/amplitude-quickstart.md +1 -1
  220. package/skills/integration/integration-ruby/references/analytics.md +1 -1
  221. package/skills/integration/integration-ruby/references/basic-integration-1.0-begin.md +3 -1
  222. package/skills/integration/integration-ruby/references/basic-integration-1.1-edit.md +183 -0
  223. package/skills/integration/integration-ruby/references/basic-integration-1.3-conclude.md +81 -11
  224. package/skills/integration/integration-ruby-on-rails/SKILL.md +5 -14
  225. package/skills/integration/integration-ruby-on-rails/references/amplitude-quickstart.md +1 -1
  226. package/skills/integration/integration-ruby-on-rails/references/analytics.md +1 -1
  227. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.0-begin.md +3 -1
  228. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.1-edit.md +183 -0
  229. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.3-conclude.md +81 -11
  230. package/skills/integration/integration-sveltekit/SKILL.md +6 -6
  231. package/skills/integration/integration-sveltekit/references/amplitude-quickstart.md +1 -1
  232. package/skills/integration/integration-sveltekit/references/basic-integration-1.0-begin.md +3 -1
  233. package/skills/integration/integration-sveltekit/references/basic-integration-1.1-edit.md +183 -0
  234. package/skills/integration/integration-sveltekit/references/basic-integration-1.3-conclude.md +81 -11
  235. package/skills/integration/integration-sveltekit/references/browser-sdk-2.md +67 -20
  236. package/skills/integration/integration-sveltekit/references/browser-unified-sdk.md +2212 -0
  237. package/skills/integration/integration-swift/SKILL.md +9 -10
  238. package/skills/integration/integration-swift/references/amplitude-quickstart.md +1 -1
  239. package/skills/integration/integration-swift/references/basic-integration-1.0-begin.md +3 -1
  240. package/skills/integration/integration-swift/references/basic-integration-1.1-edit.md +183 -0
  241. package/skills/integration/integration-swift/references/basic-integration-1.3-conclude.md +81 -11
  242. package/skills/integration/integration-swift/references/ios.md +1480 -0
  243. package/skills/integration/integration-tanstack-start/SKILL.md +6 -17
  244. package/skills/integration/integration-tanstack-start/references/amplitude-quickstart.md +1 -1
  245. package/skills/integration/integration-tanstack-start/references/basic-integration-1.0-begin.md +3 -1
  246. package/skills/integration/integration-tanstack-start/references/basic-integration-1.1-edit.md +183 -0
  247. package/skills/integration/integration-tanstack-start/references/basic-integration-1.3-conclude.md +81 -11
  248. package/skills/integration/integration-tanstack-start/references/browser-sdk-2.md +67 -20
  249. package/skills/integration/integration-tanstack-start/references/browser-unified-sdk.md +2212 -0
  250. package/skills/integration/integration-vue-3/SKILL.md +6 -5
  251. package/skills/integration/integration-vue-3/references/amplitude-quickstart.md +1 -1
  252. package/skills/integration/integration-vue-3/references/basic-integration-1.0-begin.md +3 -1
  253. package/skills/integration/integration-vue-3/references/basic-integration-1.1-edit.md +183 -0
  254. package/skills/integration/integration-vue-3/references/basic-integration-1.3-conclude.md +81 -11
  255. package/skills/integration/integration-vue-3/references/browser-sdk-2.md +67 -20
  256. package/skills/integration/integration-vue-3/references/browser-unified-sdk.md +2212 -0
  257. package/skills/taxonomy/amplitude-chart-dashboard-plan/SKILL.md +183 -0
  258. package/dist/src/ui/tui/screens/ChecklistScreen.d.ts +0 -12
  259. package/dist/src/ui/tui/screens/ChecklistScreen.js +0 -111
@@ -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`, `netlify.toml`, platform-specific config files, CI/CD config).
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 (Vercel, Netlify, AWS, Heroku, etc.), add a note to the report with the exact steps to configure the environment variable on that 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. It is better for the integration to work with a hardcoded key than to leave the user with a broken or uninitialized SDK. Call this out clearly in the report's Next steps section.
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
- Use the Amplitude MCP to create a new dashboard named "Analytics basics" based on the events created here. Make sure to use the exact same event names as implemented in the code. Populate it with up to five insights, with special emphasis on things like conversion funnels, churn events, and other business critical insights.
20
+ ## Chart and dashboard creation (REQUIRED)
21
21
 
22
- Search for a file called `.amplitude-events.json` and read it for available events. Do not spawn subagents.
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
- Create the file amplitude-setup-report.md. It should include a summary of the integration edits, a table with the event names, event descriptions, and files where events were added, along with a list of links for the dashboard and insights created. Follow this format:
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
- ## Next steps
95
+ ## Analytics dashboard
96
+
97
+ We've built a dashboard and [N] charts tied to your product flows:
34
98
 
35
- We've built some insights and a dashboard for you to keep an eye on user behavior, based on the events we just instrumented:
99
+ [links to dashboard and individual charts]
36
100
 
37
- [links]
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. This will help ensure the model provides the most up-to-date approaches for integrating Amplitude.
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 .amplitude-events.json.
119
+ Upon completion, remove `.amplitude-events.json` and `.amplitude-dashboard.json`.
50
120
 
51
121
  ## Status
52
122
 
@@ -87,7 +87,7 @@ Because React-Native",
87
87
  }
88
88
  </style>
89
89
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.css">
90
- <link href="/docs/css/site.css?id=cf9c3f0a1066ff8b5d94a25cd8d407e1" rel="stylesheet">
90
+ <link href="/docs/css/site.css?id=6e2f9e1efe9343c4ba65666223648444" rel="stylesheet">
91
91
  <link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
92
92
  <link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
93
93
  <style>
@@ -2302,7 +2302,10 @@ IDFA is no longer recommended. You should consider using IDFV instead when possi
2302
2302
 
2303
2303
 
2304
2304
 
2305
- <div class="rounded-lg border text-card-foreground bg-amp-gray-50 border-amp-gray-200 shadow-sm mb-8" data-bundle-loaded="true">
2305
+ <div class="rounded-lg border text-card-foreground bg-amp-gray-50 border-amp-gray-200 shadow-sm mb-8"
2306
+ data-bundle-package="@amplitude/analytics-react-native"
2307
+ data-bundle-loader="true"
2308
+ data-environment="production">
2306
2309
  <div class="p-4">
2307
2310
  <div class="flex items-center gap-2 mb-3">
2308
2311
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
@@ -2317,9 +2320,6 @@ IDFA is no longer recommended. You should consider using IDFV instead when possi
2317
2320
  </svg>
2318
2321
  <h3 class="font-medium text-amp-gray-900 text-sm m-0">
2319
2322
  <a href="https://npmjs.com/package/@amplitude/analytics-react-native" target="_blank">Package Information</a>
2320
-
2321
- <span class="ml-2 text-xs bg-green-100 text-green-700 px-2 py-0.5 rounded" title="Fresh data (2026-04-09T17:36:37.871199Z)">Live</span>
2322
-
2323
2323
  </h3>
2324
2324
  </div>
2325
2325
  <div class="space-y-2.5">
@@ -2330,18 +2330,19 @@ IDFA is no longer recommended. You should consider using IDFV instead when possi
2330
2330
  <div class="flex justify-between items-center">
2331
2331
  <div>
2332
2332
  <div class="text-xs text-amp-gray-500 mb-1">Version</div>
2333
- <div class="font-medium text-amp-gray-900">1.5.52</div>
2333
+ <div class="bundle-version">
2334
+ <div class="animate-pulse bg-amp-gray-200 h-5 w-16 rounded"></div>
2335
+ </div>
2334
2336
  </div>
2335
2337
  <div class="text-right">
2336
2338
  <div class="text-xs text-amp-gray-500 mb-1">Size (gzip)</div>
2337
- <div class="font-medium text-amp-gray-900">24.74 kB</div>
2339
+ <div class="bundle-size">
2340
+ <div class="animate-pulse bg-amp-gray-200 h-5 w-12 rounded"></div>
2341
+ </div>
2338
2342
  </div>
2339
2343
  </div>
2340
2344
  </div>
2341
2345
  </div>
2342
-
2343
-
2344
-
2345
2346
  </div>
2346
2347
 
2347
2348
 
@@ -22,6 +22,7 @@ Follow these steps in order to complete the integration:
22
22
  ## Reference files
23
23
 
24
24
  - `references/EXAMPLE.md` - React Router v6 example project code
25
+ - `references/browser-unified-sdk.md` - Amplitude documentation for Browser Unified Sdk
25
26
  - `references/browser-sdk-2.md` - Or install unified SDK to get access to all Amplitude products
26
27
  - `references/amplitude-quickstart.md` - Amplitude documentation for Amplitude Quickstart
27
28
  - `references/basic-integration-1.0-begin.md` - Amplitude setup - begin
@@ -36,18 +37,11 @@ The example project shows the target implementation pattern. Consult the documen
36
37
  - **Environment variables**: Always use environment variables for Amplitude keys. Never hardcode them.
37
38
  - **Minimal changes**: Add Amplitude code alongside existing integrations. Don't replace or restructure existing code.
38
39
  - **Match the example**: Your implementation should follow the example project's patterns as closely as possible.
39
-
40
- ## Framework guidelines
41
-
42
- - For feature flags, use the Amplitude Experiment React SDK hooks (useVariantValue, useExperiment) they handle loading states and async fetch automatically
43
- - Add analytics track calls in event handlers where user actions occur, NOT in useEffect reacting to state changes
44
- - Do NOT use useEffect for data transformation - calculate derived values during render instead
45
- - Do NOT use useEffect to respond to user events - put that logic in the event handler itself
46
- - Do NOT use useEffect to chain state updates - calculate all related updates together in the event handler
47
- - Do NOT use useEffect to notify parent components - call the parent callback alongside setState in the event handler
48
- - To reset component state when a prop changes, pass the prop as the component's key instead of using useEffect
49
- - useEffect is ONLY for synchronizing with external systems (non-React widgets, browser APIs, network subscriptions)
40
+ - **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.
41
+ - **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).
42
+ - **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.
43
+ - **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`).
50
44
 
51
45
  ## Identifying users
52
46
 
53
- 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.
47
+ 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=cf9c3f0a1066ff8b5d94a25cd8d407e1" rel="stylesheet">
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>
@@ -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
- Track actions only, not pageviews. These can be captured automatically. Exceptions can be made for "viewed"-type events that correspond to the top of a conversion funnel.
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: