@amplitude/wizard 1.0.0-beta.2 → 1.0.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 (391) hide show
  1. package/README.md +171 -74
  2. package/dist/bin.js +338 -222
  3. package/dist/src/lib/agent-interface.js +64 -9
  4. package/dist/src/lib/agent-runner.js +1 -10
  5. package/dist/src/lib/api.d.ts +22 -4
  6. package/dist/src/lib/api.js +114 -12
  7. package/dist/src/lib/commandments.js +14 -1
  8. package/dist/src/lib/constants.d.ts +6 -5
  9. package/dist/src/lib/constants.js +13 -13
  10. package/dist/src/lib/credential-resolution.d.ts +45 -0
  11. package/dist/src/lib/credential-resolution.js +311 -0
  12. package/dist/src/lib/exit-codes.d.ts +10 -0
  13. package/dist/src/lib/exit-codes.js +12 -0
  14. package/dist/src/lib/health-checks/statuspage.d.ts +1 -0
  15. package/dist/src/lib/health-checks/statuspage.js +5 -1
  16. package/dist/src/lib/mode-config.d.ts +14 -0
  17. package/dist/src/lib/mode-config.js +14 -0
  18. package/dist/src/lib/session-checkpoint.d.ts +27 -0
  19. package/dist/src/lib/session-checkpoint.js +134 -0
  20. package/dist/src/lib/wizard-session.d.ts +44 -1
  21. package/dist/src/lib/wizard-session.js +70 -14
  22. package/dist/src/lib/wizard-tools.js +19 -4
  23. package/dist/src/steps/add-mcp-server-to-clients/clients/claude.d.ts +3 -0
  24. package/dist/src/steps/add-mcp-server-to-clients/clients/claude.js +6 -0
  25. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js +3 -1
  26. package/dist/src/ui/agent-ui.d.ts +91 -0
  27. package/dist/src/ui/agent-ui.js +277 -0
  28. package/dist/src/ui/logging-ui.js +1 -1
  29. package/dist/src/ui/tui/App.d.ts +12 -0
  30. package/dist/src/ui/tui/App.js +29 -18
  31. package/dist/src/ui/tui/components/AmplitudeLogo.js +16 -17
  32. package/dist/src/ui/tui/components/AmplitudeTextLogo.d.ts +0 -2
  33. package/dist/src/ui/tui/components/AmplitudeTextLogo.js +53 -18
  34. package/dist/src/ui/tui/components/BrailleSpinner.d.ts +8 -0
  35. package/dist/src/ui/tui/components/BrailleSpinner.js +15 -0
  36. package/dist/src/ui/tui/components/ConsoleView.d.ts +8 -11
  37. package/dist/src/ui/tui/components/ConsoleView.js +51 -34
  38. package/dist/src/ui/tui/components/HeaderBar.d.ts +12 -0
  39. package/dist/src/ui/tui/components/HeaderBar.js +17 -0
  40. package/dist/src/ui/tui/components/JourneyStepper.d.ts +16 -0
  41. package/dist/src/ui/tui/components/JourneyStepper.js +83 -0
  42. package/dist/src/ui/tui/components/KeyHintBar.d.ts +19 -0
  43. package/dist/src/ui/tui/components/KeyHintBar.js +20 -0
  44. package/dist/src/ui/tui/console-commands.d.ts +1 -2
  45. package/dist/src/ui/tui/console-commands.js +48 -7
  46. package/dist/src/ui/tui/flows.d.ts +1 -1
  47. package/dist/src/ui/tui/flows.js +1 -1
  48. package/dist/src/ui/tui/hooks/useAsyncEffect.d.ts +15 -0
  49. package/dist/src/ui/tui/hooks/useAsyncEffect.js +35 -0
  50. package/dist/src/ui/tui/hooks/useWizardStore.d.ts +9 -0
  51. package/dist/src/ui/tui/hooks/useWizardStore.js +11 -0
  52. package/dist/src/ui/tui/ink-ui.js +1 -1
  53. package/dist/src/ui/tui/primitives/DissolveTransition.js +4 -5
  54. package/dist/src/ui/tui/primitives/EventPlanViewer.d.ts +3 -1
  55. package/dist/src/ui/tui/primitives/EventPlanViewer.js +8 -3
  56. package/dist/src/ui/tui/primitives/ProgressList.js +1 -1
  57. package/dist/src/ui/tui/primitives/SlashCommandInput.js +19 -4
  58. package/dist/src/ui/tui/primitives/SplitView.d.ts +2 -1
  59. package/dist/src/ui/tui/primitives/SplitView.js +10 -2
  60. package/dist/src/ui/tui/primitives/TabContainer.js +10 -2
  61. package/dist/src/ui/tui/primitives/index.d.ts +0 -1
  62. package/dist/src/ui/tui/primitives/index.js +0 -1
  63. package/dist/src/ui/tui/router.js +1 -1
  64. package/dist/src/ui/tui/screen-registry.d.ts +0 -7
  65. package/dist/src/ui/tui/screen-registry.js +13 -4
  66. package/dist/src/ui/tui/screens/ActivationOptionsScreen.d.ts +2 -2
  67. package/dist/src/ui/tui/screens/ActivationOptionsScreen.js +8 -8
  68. package/dist/src/ui/tui/screens/AuthScreen.js +57 -27
  69. package/dist/src/ui/tui/screens/ChecklistScreen.d.ts +2 -12
  70. package/dist/src/ui/tui/screens/ChecklistScreen.js +22 -33
  71. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.d.ts +3 -12
  72. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.js +109 -39
  73. package/dist/src/ui/tui/screens/DataSetupScreen.d.ts +3 -3
  74. package/dist/src/ui/tui/screens/DataSetupScreen.js +17 -10
  75. package/dist/src/ui/tui/screens/IntroScreen.d.ts +5 -3
  76. package/dist/src/ui/tui/screens/IntroScreen.js +132 -41
  77. package/dist/src/ui/tui/screens/LoginScreen.d.ts +1 -1
  78. package/dist/src/ui/tui/screens/LoginScreen.js +4 -4
  79. package/dist/src/ui/tui/screens/LogoutScreen.d.ts +4 -2
  80. package/dist/src/ui/tui/screens/LogoutScreen.js +17 -5
  81. package/dist/src/ui/tui/screens/McpScreen.d.ts +4 -4
  82. package/dist/src/ui/tui/screens/McpScreen.js +25 -17
  83. package/dist/src/ui/tui/screens/OutageScreen.d.ts +1 -1
  84. package/dist/src/ui/tui/screens/OutageScreen.js +5 -5
  85. package/dist/src/ui/tui/screens/OutroScreen.d.ts +5 -0
  86. package/dist/src/ui/tui/screens/OutroScreen.js +21 -14
  87. package/dist/src/ui/tui/screens/RegionSelectScreen.js +15 -13
  88. package/dist/src/ui/tui/screens/RunScreen.d.ts +7 -5
  89. package/dist/src/ui/tui/screens/RunScreen.js +102 -157
  90. package/dist/src/ui/tui/screens/SettingsOverrideScreen.d.ts +1 -1
  91. package/dist/src/ui/tui/screens/SettingsOverrideScreen.js +6 -5
  92. package/dist/src/ui/tui/screens/SetupScreen.d.ts +1 -1
  93. package/dist/src/ui/tui/screens/SetupScreen.js +7 -7
  94. package/dist/src/ui/tui/screens/SlackScreen.d.ts +2 -2
  95. package/dist/src/ui/tui/screens/SlackScreen.js +60 -35
  96. package/dist/src/ui/tui/session-constants.d.ts +41 -0
  97. package/dist/src/ui/tui/session-constants.js +38 -0
  98. package/dist/src/ui/tui/start-tui.d.ts +3 -1
  99. package/dist/src/ui/tui/start-tui.js +14 -10
  100. package/dist/src/ui/tui/store.d.ts +2 -1
  101. package/dist/src/ui/tui/store.js +33 -7
  102. package/dist/src/ui/tui/styles.d.ts +75 -19
  103. package/dist/src/ui/tui/styles.js +101 -19
  104. package/dist/src/ui/tui/utils/classify-error.d.ts +14 -0
  105. package/dist/src/ui/tui/utils/classify-error.js +90 -0
  106. package/dist/src/ui/tui/utils/diagnostics.d.ts +21 -0
  107. package/dist/src/ui/tui/utils/diagnostics.js +72 -0
  108. package/dist/src/ui/tui/utils/with-retry.d.ts +12 -0
  109. package/dist/src/ui/tui/utils/with-retry.js +32 -0
  110. package/dist/src/ui/tui/utils/with-timeout.d.ts +10 -0
  111. package/dist/src/ui/tui/utils/with-timeout.js +24 -0
  112. package/dist/src/utils/ampli-settings.d.ts +1 -1
  113. package/dist/src/utils/ampli-settings.js +15 -5
  114. package/dist/src/utils/api-key-store.js +5 -5
  115. package/dist/src/utils/atomic-write.d.ts +15 -0
  116. package/dist/src/utils/atomic-write.js +34 -0
  117. package/dist/src/utils/setup-utils.js +2 -2
  118. package/dist/src/utils/token-refresh.d.ts +22 -0
  119. package/dist/src/utils/token-refresh.js +79 -0
  120. package/dist/src/utils/wizard-abort.js +6 -1
  121. package/package.json +6 -6
  122. package/skills/instrumentation/add-analytics-instrumentation/SKILL.md +142 -0
  123. package/skills/instrumentation/diff-intake/SKILL.md +128 -0
  124. package/skills/instrumentation/discover-analytics-patterns/SKILL.md +185 -0
  125. package/skills/instrumentation/discover-event-surfaces/SKILL.md +322 -0
  126. package/skills/instrumentation/discover-event-surfaces/references/best-practices.md +563 -0
  127. package/skills/instrumentation/instrument-events/SKILL.md +169 -0
  128. package/skills/instrumentation/instrument-events/references/best-practices.md +563 -0
  129. package/skills/integration/integration-android/SKILL.md +49 -0
  130. package/skills/integration/integration-android/references/EXAMPLE.md +1977 -0
  131. package/skills/integration/integration-android/references/amplitude-quickstart.md +1845 -0
  132. package/skills/integration/integration-android/references/analytics.md +1778 -0
  133. package/skills/integration/integration-android/references/basic-integration-1.0-begin.md +43 -0
  134. package/skills/integration/integration-android/references/basic-integration-1.1-edit.md +35 -0
  135. package/skills/integration/integration-android/references/basic-integration-1.2-revise.md +23 -0
  136. package/skills/integration/integration-android/references/basic-integration-1.3-conclude.md +57 -0
  137. package/skills/integration/integration-angular/SKILL.md +49 -0
  138. package/skills/integration/integration-angular/references/EXAMPLE.md +899 -0
  139. package/skills/integration/integration-angular/references/amplitude-quickstart.md +1845 -0
  140. package/skills/integration/integration-angular/references/basic-integration-1.0-begin.md +43 -0
  141. package/skills/integration/integration-angular/references/basic-integration-1.1-edit.md +35 -0
  142. package/skills/integration/integration-angular/references/basic-integration-1.2-revise.md +23 -0
  143. package/skills/integration/integration-angular/references/basic-integration-1.3-conclude.md +57 -0
  144. package/skills/integration/integration-angular/references/browser-sdk-2.md +4680 -0
  145. package/skills/integration/integration-astro-hybrid/SKILL.md +56 -0
  146. package/skills/integration/integration-astro-hybrid/references/EXAMPLE.md +1095 -0
  147. package/skills/integration/integration-astro-hybrid/references/amplitude-quickstart.md +1845 -0
  148. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.0-begin.md +43 -0
  149. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.1-edit.md +35 -0
  150. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.2-revise.md +23 -0
  151. package/skills/integration/integration-astro-hybrid/references/basic-integration-1.3-conclude.md +57 -0
  152. package/skills/integration/integration-astro-hybrid/references/browser-sdk-2.md +4680 -0
  153. package/skills/integration/integration-astro-ssr/SKILL.md +52 -0
  154. package/skills/integration/integration-astro-ssr/references/EXAMPLE.md +1106 -0
  155. package/skills/integration/integration-astro-ssr/references/amplitude-quickstart.md +1845 -0
  156. package/skills/integration/integration-astro-ssr/references/basic-integration-1.0-begin.md +43 -0
  157. package/skills/integration/integration-astro-ssr/references/basic-integration-1.1-edit.md +35 -0
  158. package/skills/integration/integration-astro-ssr/references/basic-integration-1.2-revise.md +23 -0
  159. package/skills/integration/integration-astro-ssr/references/basic-integration-1.3-conclude.md +57 -0
  160. package/skills/integration/integration-astro-ssr/references/browser-sdk-2.md +4680 -0
  161. package/skills/integration/integration-astro-static/SKILL.md +49 -0
  162. package/skills/integration/integration-astro-static/references/EXAMPLE.md +910 -0
  163. package/skills/integration/integration-astro-static/references/amplitude-quickstart.md +1845 -0
  164. package/skills/integration/integration-astro-static/references/basic-integration-1.0-begin.md +43 -0
  165. package/skills/integration/integration-astro-static/references/basic-integration-1.1-edit.md +35 -0
  166. package/skills/integration/integration-astro-static/references/basic-integration-1.2-revise.md +23 -0
  167. package/skills/integration/integration-astro-static/references/basic-integration-1.3-conclude.md +57 -0
  168. package/skills/integration/integration-astro-static/references/browser-sdk-2.md +4680 -0
  169. package/skills/integration/integration-astro-view-transitions/SKILL.md +51 -0
  170. package/skills/integration/integration-astro-view-transitions/references/EXAMPLE.md +979 -0
  171. package/skills/integration/integration-astro-view-transitions/references/amplitude-quickstart.md +1845 -0
  172. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.0-begin.md +43 -0
  173. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.1-edit.md +35 -0
  174. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.2-revise.md +23 -0
  175. package/skills/integration/integration-astro-view-transitions/references/basic-integration-1.3-conclude.md +57 -0
  176. package/skills/integration/integration-astro-view-transitions/references/browser-sdk-2.md +4680 -0
  177. package/skills/integration/integration-django/SKILL.md +57 -0
  178. package/skills/integration/integration-django/references/EXAMPLE.md +1005 -0
  179. package/skills/integration/integration-django/references/amplitude-quickstart.md +1845 -0
  180. package/skills/integration/integration-django/references/basic-integration-1.0-begin.md +43 -0
  181. package/skills/integration/integration-django/references/basic-integration-1.1-edit.md +35 -0
  182. package/skills/integration/integration-django/references/basic-integration-1.2-revise.md +23 -0
  183. package/skills/integration/integration-django/references/basic-integration-1.3-conclude.md +57 -0
  184. package/skills/integration/integration-django/references/python.md +1424 -0
  185. package/skills/integration/integration-expo/SKILL.md +53 -0
  186. package/skills/integration/integration-expo/references/EXAMPLE.md +1291 -0
  187. package/skills/integration/integration-expo/references/amplitude-quickstart.md +1845 -0
  188. package/skills/integration/integration-expo/references/basic-integration-1.0-begin.md +43 -0
  189. package/skills/integration/integration-expo/references/basic-integration-1.1-edit.md +35 -0
  190. package/skills/integration/integration-expo/references/basic-integration-1.2-revise.md +23 -0
  191. package/skills/integration/integration-expo/references/basic-integration-1.3-conclude.md +57 -0
  192. package/skills/integration/integration-expo/references/react-native-sdk.md +2819 -0
  193. package/skills/integration/integration-fastapi/SKILL.md +57 -0
  194. package/skills/integration/integration-fastapi/references/EXAMPLE.md +1389 -0
  195. package/skills/integration/integration-fastapi/references/amplitude-quickstart.md +1845 -0
  196. package/skills/integration/integration-fastapi/references/basic-integration-1.0-begin.md +43 -0
  197. package/skills/integration/integration-fastapi/references/basic-integration-1.1-edit.md +35 -0
  198. package/skills/integration/integration-fastapi/references/basic-integration-1.2-revise.md +23 -0
  199. package/skills/integration/integration-fastapi/references/basic-integration-1.3-conclude.md +57 -0
  200. package/skills/integration/integration-fastapi/references/python.md +1424 -0
  201. package/skills/integration/integration-flask/SKILL.md +56 -0
  202. package/skills/integration/integration-flask/references/EXAMPLE.md +1130 -0
  203. package/skills/integration/integration-flask/references/amplitude-quickstart.md +1845 -0
  204. package/skills/integration/integration-flask/references/basic-integration-1.0-begin.md +43 -0
  205. package/skills/integration/integration-flask/references/basic-integration-1.1-edit.md +35 -0
  206. package/skills/integration/integration-flask/references/basic-integration-1.2-revise.md +23 -0
  207. package/skills/integration/integration-flask/references/basic-integration-1.3-conclude.md +57 -0
  208. package/skills/integration/integration-flask/references/python.md +1424 -0
  209. package/skills/integration/integration-javascript_node/SKILL.md +54 -0
  210. package/skills/integration/integration-javascript_node/references/EXAMPLE.md +365 -0
  211. package/skills/integration/integration-javascript_node/references/amplitude-quickstart.md +1845 -0
  212. package/skills/integration/integration-javascript_node/references/analytics.md +1778 -0
  213. package/skills/integration/integration-javascript_node/references/basic-integration-1.0-begin.md +43 -0
  214. package/skills/integration/integration-javascript_node/references/basic-integration-1.1-edit.md +35 -0
  215. package/skills/integration/integration-javascript_node/references/basic-integration-1.2-revise.md +23 -0
  216. package/skills/integration/integration-javascript_node/references/basic-integration-1.3-conclude.md +57 -0
  217. package/skills/integration/integration-javascript_web/SKILL.md +58 -0
  218. package/skills/integration/integration-javascript_web/references/EXAMPLE.md +451 -0
  219. package/skills/integration/integration-javascript_web/references/amplitude-quickstart.md +1845 -0
  220. package/skills/integration/integration-javascript_web/references/basic-integration-1.0-begin.md +43 -0
  221. package/skills/integration/integration-javascript_web/references/basic-integration-1.1-edit.md +35 -0
  222. package/skills/integration/integration-javascript_web/references/basic-integration-1.2-revise.md +23 -0
  223. package/skills/integration/integration-javascript_web/references/basic-integration-1.3-conclude.md +57 -0
  224. package/skills/integration/integration-javascript_web/references/browser-sdk-2.md +4680 -0
  225. package/skills/integration/integration-laravel/SKILL.md +52 -0
  226. package/skills/integration/integration-laravel/references/EXAMPLE.md +2039 -0
  227. package/skills/integration/integration-laravel/references/amplitude-quickstart.md +1845 -0
  228. package/skills/integration/integration-laravel/references/analytics.md +1778 -0
  229. package/skills/integration/integration-laravel/references/basic-integration-1.0-begin.md +43 -0
  230. package/skills/integration/integration-laravel/references/basic-integration-1.1-edit.md +35 -0
  231. package/skills/integration/integration-laravel/references/basic-integration-1.2-revise.md +23 -0
  232. package/skills/integration/integration-laravel/references/basic-integration-1.3-conclude.md +57 -0
  233. package/skills/integration/integration-nextjs-app-router/SKILL.md +54 -0
  234. package/skills/integration/integration-nextjs-app-router/references/EXAMPLE.md +673 -0
  235. package/skills/integration/integration-nextjs-app-router/references/amplitude-quickstart.md +1845 -0
  236. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.0-begin.md +43 -0
  237. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.1-edit.md +35 -0
  238. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.2-revise.md +23 -0
  239. package/skills/integration/integration-nextjs-app-router/references/basic-integration-1.3-conclude.md +57 -0
  240. package/skills/integration/integration-nextjs-app-router/references/browser-sdk-2.md +4680 -0
  241. package/skills/integration/integration-nextjs-pages-router/SKILL.md +54 -0
  242. package/skills/integration/integration-nextjs-pages-router/references/EXAMPLE.md +735 -0
  243. package/skills/integration/integration-nextjs-pages-router/references/amplitude-quickstart.md +1845 -0
  244. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.0-begin.md +43 -0
  245. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.1-edit.md +35 -0
  246. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.2-revise.md +23 -0
  247. package/skills/integration/integration-nextjs-pages-router/references/basic-integration-1.3-conclude.md +57 -0
  248. package/skills/integration/integration-nextjs-pages-router/references/browser-sdk-2.md +4680 -0
  249. package/skills/integration/integration-nuxt-3.6/SKILL.md +46 -0
  250. package/skills/integration/integration-nuxt-3.6/references/EXAMPLE.md +8422 -0
  251. package/skills/integration/integration-nuxt-3.6/references/amplitude-quickstart.md +1845 -0
  252. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.0-begin.md +43 -0
  253. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.1-edit.md +35 -0
  254. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.2-revise.md +23 -0
  255. package/skills/integration/integration-nuxt-3.6/references/basic-integration-1.3-conclude.md +57 -0
  256. package/skills/integration/integration-nuxt-3.6/references/browser-sdk-2.md +4680 -0
  257. package/skills/integration/integration-nuxt-4/SKILL.md +46 -0
  258. package/skills/integration/integration-nuxt-4/references/EXAMPLE.md +8670 -0
  259. package/skills/integration/integration-nuxt-4/references/amplitude-quickstart.md +1845 -0
  260. package/skills/integration/integration-nuxt-4/references/basic-integration-1.0-begin.md +43 -0
  261. package/skills/integration/integration-nuxt-4/references/basic-integration-1.1-edit.md +35 -0
  262. package/skills/integration/integration-nuxt-4/references/basic-integration-1.2-revise.md +23 -0
  263. package/skills/integration/integration-nuxt-4/references/basic-integration-1.3-conclude.md +57 -0
  264. package/skills/integration/integration-nuxt-4/references/browser-sdk-2.md +4680 -0
  265. package/skills/integration/integration-python/SKILL.md +53 -0
  266. package/skills/integration/integration-python/references/EXAMPLE.md +445 -0
  267. package/skills/integration/integration-python/references/amplitude-quickstart.md +1845 -0
  268. package/skills/integration/integration-python/references/basic-integration-1.0-begin.md +43 -0
  269. package/skills/integration/integration-python/references/basic-integration-1.1-edit.md +35 -0
  270. package/skills/integration/integration-python/references/basic-integration-1.2-revise.md +23 -0
  271. package/skills/integration/integration-python/references/basic-integration-1.3-conclude.md +57 -0
  272. package/skills/integration/integration-python/references/python.md +1424 -0
  273. package/skills/integration/integration-react-native/SKILL.md +49 -0
  274. package/skills/integration/integration-react-native/references/EXAMPLE.md +2253 -0
  275. package/skills/integration/integration-react-native/references/amplitude-quickstart.md +1845 -0
  276. package/skills/integration/integration-react-native/references/basic-integration-1.0-begin.md +43 -0
  277. package/skills/integration/integration-react-native/references/basic-integration-1.1-edit.md +35 -0
  278. package/skills/integration/integration-react-native/references/basic-integration-1.2-revise.md +23 -0
  279. package/skills/integration/integration-react-native/references/basic-integration-1.3-conclude.md +57 -0
  280. package/skills/integration/integration-react-native/references/react-native-sdk.md +2819 -0
  281. package/skills/integration/integration-react-react-router-6/SKILL.md +53 -0
  282. package/skills/integration/integration-react-react-router-6/references/EXAMPLE.md +570 -0
  283. package/skills/integration/integration-react-react-router-6/references/amplitude-quickstart.md +1845 -0
  284. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.0-begin.md +43 -0
  285. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.1-edit.md +35 -0
  286. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.2-revise.md +23 -0
  287. package/skills/integration/integration-react-react-router-6/references/basic-integration-1.3-conclude.md +57 -0
  288. package/skills/integration/integration-react-react-router-6/references/browser-sdk-2.md +4680 -0
  289. package/skills/integration/integration-react-react-router-7-data/SKILL.md +53 -0
  290. package/skills/integration/integration-react-react-router-7-data/references/EXAMPLE.md +830 -0
  291. package/skills/integration/integration-react-react-router-7-data/references/amplitude-quickstart.md +1845 -0
  292. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.0-begin.md +43 -0
  293. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.1-edit.md +35 -0
  294. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.2-revise.md +23 -0
  295. package/skills/integration/integration-react-react-router-7-data/references/basic-integration-1.3-conclude.md +57 -0
  296. package/skills/integration/integration-react-react-router-7-data/references/browser-sdk-2.md +4680 -0
  297. package/skills/integration/integration-react-react-router-7-declarative/SKILL.md +53 -0
  298. package/skills/integration/integration-react-react-router-7-declarative/references/EXAMPLE.md +609 -0
  299. package/skills/integration/integration-react-react-router-7-declarative/references/amplitude-quickstart.md +1845 -0
  300. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.0-begin.md +43 -0
  301. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.1-edit.md +35 -0
  302. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.2-revise.md +23 -0
  303. package/skills/integration/integration-react-react-router-7-declarative/references/basic-integration-1.3-conclude.md +57 -0
  304. package/skills/integration/integration-react-react-router-7-declarative/references/browser-sdk-2.md +4680 -0
  305. package/skills/integration/integration-react-react-router-7-framework/SKILL.md +53 -0
  306. package/skills/integration/integration-react-react-router-7-framework/references/EXAMPLE.md +1081 -0
  307. package/skills/integration/integration-react-react-router-7-framework/references/amplitude-quickstart.md +1845 -0
  308. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.0-begin.md +43 -0
  309. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.1-edit.md +35 -0
  310. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.2-revise.md +23 -0
  311. package/skills/integration/integration-react-react-router-7-framework/references/basic-integration-1.3-conclude.md +57 -0
  312. package/skills/integration/integration-react-react-router-7-framework/references/browser-sdk-2.md +4680 -0
  313. package/skills/integration/integration-react-tanstack-router-code-based/SKILL.md +57 -0
  314. package/skills/integration/integration-react-tanstack-router-code-based/references/EXAMPLE.md +659 -0
  315. package/skills/integration/integration-react-tanstack-router-code-based/references/amplitude-quickstart.md +1845 -0
  316. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.0-begin.md +43 -0
  317. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.1-edit.md +35 -0
  318. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.2-revise.md +23 -0
  319. package/skills/integration/integration-react-tanstack-router-code-based/references/basic-integration-1.3-conclude.md +57 -0
  320. package/skills/integration/integration-react-tanstack-router-code-based/references/browser-sdk-2.md +4680 -0
  321. package/skills/integration/integration-react-tanstack-router-file-based/SKILL.md +57 -0
  322. package/skills/integration/integration-react-tanstack-router-file-based/references/EXAMPLE.md +777 -0
  323. package/skills/integration/integration-react-tanstack-router-file-based/references/amplitude-quickstart.md +1845 -0
  324. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.0-begin.md +43 -0
  325. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.1-edit.md +35 -0
  326. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.2-revise.md +23 -0
  327. package/skills/integration/integration-react-tanstack-router-file-based/references/basic-integration-1.3-conclude.md +57 -0
  328. package/skills/integration/integration-react-tanstack-router-file-based/references/browser-sdk-2.md +4680 -0
  329. package/skills/integration/integration-react-vite/SKILL.md +53 -0
  330. package/skills/integration/integration-react-vite/references/EXAMPLE.md +542 -0
  331. package/skills/integration/integration-react-vite/references/amplitude-quickstart.md +1845 -0
  332. package/skills/integration/integration-react-vite/references/basic-integration-1.0-begin.md +43 -0
  333. package/skills/integration/integration-react-vite/references/basic-integration-1.1-edit.md +35 -0
  334. package/skills/integration/integration-react-vite/references/basic-integration-1.2-revise.md +23 -0
  335. package/skills/integration/integration-react-vite/references/basic-integration-1.3-conclude.md +57 -0
  336. package/skills/integration/integration-react-vite/references/browser-sdk-2.md +4680 -0
  337. package/skills/integration/integration-ruby/SKILL.md +50 -0
  338. package/skills/integration/integration-ruby/references/EXAMPLE.md +420 -0
  339. package/skills/integration/integration-ruby/references/amplitude-quickstart.md +1845 -0
  340. package/skills/integration/integration-ruby/references/analytics.md +1778 -0
  341. package/skills/integration/integration-ruby/references/basic-integration-1.0-begin.md +43 -0
  342. package/skills/integration/integration-ruby/references/basic-integration-1.1-edit.md +35 -0
  343. package/skills/integration/integration-ruby/references/basic-integration-1.2-revise.md +23 -0
  344. package/skills/integration/integration-ruby/references/basic-integration-1.3-conclude.md +57 -0
  345. package/skills/integration/integration-ruby-on-rails/SKILL.md +55 -0
  346. package/skills/integration/integration-ruby-on-rails/references/EXAMPLE.md +1013 -0
  347. package/skills/integration/integration-ruby-on-rails/references/amplitude-quickstart.md +1845 -0
  348. package/skills/integration/integration-ruby-on-rails/references/analytics.md +1778 -0
  349. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.0-begin.md +43 -0
  350. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.1-edit.md +35 -0
  351. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.2-revise.md +23 -0
  352. package/skills/integration/integration-ruby-on-rails/references/basic-integration-1.3-conclude.md +57 -0
  353. package/skills/integration/integration-sveltekit/SKILL.md +47 -0
  354. package/skills/integration/integration-sveltekit/references/EXAMPLE.md +14121 -0
  355. package/skills/integration/integration-sveltekit/references/amplitude-quickstart.md +1845 -0
  356. package/skills/integration/integration-sveltekit/references/basic-integration-1.0-begin.md +43 -0
  357. package/skills/integration/integration-sveltekit/references/basic-integration-1.1-edit.md +35 -0
  358. package/skills/integration/integration-sveltekit/references/basic-integration-1.2-revise.md +23 -0
  359. package/skills/integration/integration-sveltekit/references/basic-integration-1.3-conclude.md +57 -0
  360. package/skills/integration/integration-sveltekit/references/browser-sdk-2.md +4680 -0
  361. package/skills/integration/integration-swift/SKILL.md +49 -0
  362. package/skills/integration/integration-swift/references/EXAMPLE.md +660 -0
  363. package/skills/integration/integration-swift/references/amplitude-quickstart.md +1845 -0
  364. package/skills/integration/integration-swift/references/analytics.md +1778 -0
  365. package/skills/integration/integration-swift/references/basic-integration-1.0-begin.md +43 -0
  366. package/skills/integration/integration-swift/references/basic-integration-1.1-edit.md +35 -0
  367. package/skills/integration/integration-swift/references/basic-integration-1.2-revise.md +23 -0
  368. package/skills/integration/integration-swift/references/basic-integration-1.3-conclude.md +57 -0
  369. package/skills/integration/integration-tanstack-start/SKILL.md +58 -0
  370. package/skills/integration/integration-tanstack-start/references/EXAMPLE.md +998 -0
  371. package/skills/integration/integration-tanstack-start/references/amplitude-quickstart.md +1845 -0
  372. package/skills/integration/integration-tanstack-start/references/basic-integration-1.0-begin.md +43 -0
  373. package/skills/integration/integration-tanstack-start/references/basic-integration-1.1-edit.md +35 -0
  374. package/skills/integration/integration-tanstack-start/references/basic-integration-1.2-revise.md +23 -0
  375. package/skills/integration/integration-tanstack-start/references/basic-integration-1.3-conclude.md +57 -0
  376. package/skills/integration/integration-tanstack-start/references/browser-sdk-2.md +4680 -0
  377. package/skills/integration/integration-vue-3/SKILL.md +46 -0
  378. package/skills/integration/integration-vue-3/references/EXAMPLE.md +846 -0
  379. package/skills/integration/integration-vue-3/references/amplitude-quickstart.md +1845 -0
  380. package/skills/integration/integration-vue-3/references/basic-integration-1.0-begin.md +43 -0
  381. package/skills/integration/integration-vue-3/references/basic-integration-1.1-edit.md +35 -0
  382. package/skills/integration/integration-vue-3/references/basic-integration-1.2-revise.md +23 -0
  383. package/skills/integration/integration-vue-3/references/basic-integration-1.3-conclude.md +57 -0
  384. package/skills/integration/integration-vue-3/references/browser-sdk-2.md +4680 -0
  385. package/skills/taxonomy/amplitude-quickstart-taxonomy-agent/SKILL.md +228 -0
  386. package/dist/src/ui/tui/components/TitleBar.d.ts +0 -8
  387. package/dist/src/ui/tui/components/TitleBar.js +0 -27
  388. package/dist/src/ui/tui/primitives/KagiSmallWebViewer.d.ts +0 -7
  389. package/dist/src/ui/tui/primitives/KagiSmallWebViewer.js +0 -101
  390. package/dist/src/utils/anthropic-status.d.ts +0 -17
  391. package/dist/src/utils/anthropic-status.js +0 -51
@@ -0,0 +1,2819 @@
1
+ <!--production-->
2
+
3
+ <!doctype html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta name='zd-site-verification' content='od3rs5oc4ggcruhipz6rp' />
7
+ <meta charset="utf-8">
8
+
9
+
10
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
+ <meta name="viewport" content="width=device-width, initial-scale=1">
12
+ <meta content="The React Native SDK lets you send events to Amplitude.
13
+
14
+ React Native support
15
+ Because React-Native" name="description">
16
+ <meta name="google-site-verification" content="UHLjtoO7DV30dx3hVhwTOIWguEUr_VzS41msmq-uYKA" />
17
+
18
+ <link rel="apple-touch-icon" sizes="180x180" href="/docs/assets/general/apple-touch-icon.png">
19
+ <link rel="icon" type="image/png" sizes="32x32" href="/docs/assets/general/favicon-32x32.png">
20
+ <link rel="icon" type="image/png" sizes="16x16" href="/docs/assets/general/favicon-16x16.png">
21
+ <title>React Native SDK | Amplitude</title>
22
+
23
+ <script type="application/ld+json">
24
+ {
25
+ "@context": "https://schema.org",
26
+ "@type": "Article",
27
+ "headline": "React Native SDK",
28
+ "description": "The React Native SDK lets you send events to Amplitude.
29
+
30
+ React Native support
31
+ Because React-Native",
32
+ "url": "/docs/sdks/analytics/react-native/react-native-sdk",
33
+ "publisher": {
34
+ "@type": "Organization",
35
+ "name": "Amplitude",
36
+ "legalName": "Amplitude, Inc.",
37
+ "url": "https://amplitude.com",
38
+ "logo": {
39
+ "@type": "ImageObject",
40
+ "url": "https://amplitude.com/nextjs-public/amplitude-default-seo.png"
41
+ },
42
+ "address": {
43
+ "@type": "PostalAddress",
44
+ "streetAddress": "201 3rd St #200",
45
+ "addressLocality": "San Francisco",
46
+ "addressRegion": "CA",
47
+ "postalCode": "94103",
48
+ "addressCountry": "USA"
49
+ },
50
+ "contactPoint": {
51
+ "@type": "ContactPoint",
52
+ "telephone": "[+650-988-5131]",
53
+ "contactType": "Customer Support",
54
+ "email": "sales@amplitude.com"
55
+ },
56
+ "sameAs": [
57
+ "https://twitter.com/Amplitude_HQ",
58
+ "https://www.facebook.com/AmplitudeAnalytics/",
59
+ "https://www.linkedin.com/company/amplitude-analytics"
60
+ ]
61
+ },
62
+ "datePublished": "",
63
+ "dateModified": "July 23rd, 2024",
64
+ "mainEntityOfPage": {
65
+ "@type": "WebPage",
66
+ "@id": "/docs/sdks/analytics/react-native/react-native-sdk"
67
+ },
68
+ "author": [
69
+ {
70
+ "@type": "Organization",
71
+ "name": "Amplitude"
72
+ }
73
+ ]
74
+ }
75
+ </script>
76
+
77
+ <style>
78
+ /* Prism’s critical code-block styles only */
79
+ code[class*="language-"],
80
+ pre[class*="language-"] {
81
+ color: #2a2a2a;
82
+ background: #f5f2f0;
83
+ font-family:"IBM Plex Mono", Consolas, Menlo, monospace;
84
+ font-size: 0.9em;
85
+ white-space: pre;
86
+ /* …etc, just the essentials… */
87
+ }
88
+ </style>
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">
91
+ <link href="/docs/css/algolia.css?id=e343cc9490e043fefffa37d2817ddf8c" rel="stylesheet">
92
+ <link href="/docs/css/dracula-prism.css?id=a5713888be640854bb66b8b74c1037ce" rel="stylesheet">
93
+ <style>
94
+ pre[class*="language-"] code p {
95
+ all: unset; /* removes default block-level margins/padding */
96
+ display: inline; /* flow as if it were plain text */
97
+ }
98
+ </style>
99
+ <script src="/docs/js/site.js?id=078a82617f7dafffff92da951b4ec6c9"></script>
100
+ <script type="module" src="/docs/js/side-nav.js?id=b84c163c6c16a6a6b14fc85ee81c31e9"></script>
101
+ <script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/collapse@3.x.x/dist/cdn.min.js"></script>
102
+ <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.5/dist/cdn.min.js"></script>
103
+ <link rel="preconnect" href="https://93SYI9HL20-dsn.algolia.net" crossorigin />
104
+ <script src="https://unpkg.com/@amplitude/experiment-js-client@1.9.0/dist/experiment.umd.js"></script>
105
+ <style>
106
+ [x-cloak] {
107
+ display: none !important;
108
+ }
109
+ .copy-btn {
110
+ height: 24px;
111
+ position: absolute;
112
+ top: 0.5rem;
113
+ right: 0.5rem;
114
+ z-index: 10;
115
+ background: transparent;
116
+ border: none;
117
+ cursor: pointer;
118
+ padding: 0.25rem;
119
+ opacity: 0.6;
120
+ transition: opacity 0.2s;
121
+ }
122
+
123
+ .copy-btn:hover {
124
+ opacity: 1;
125
+ }
126
+ </style>
127
+ <script src="https://cdn.amplitude.com/script/8ec8f5cbeaf93a6717831a55add2d7a4.js"></script>
128
+ <script src="https://cdn.amplitude.com/script/8ec8f5cbeaf93a6717831a55add2d7a4.engagement.js"></script>
129
+
130
+ <script>
131
+ window.amplitude.add(window.sessionReplay.plugin({
132
+ sampleRate: 0.5
133
+ }));
134
+ window.amplitude.init('8ec8f5cbeaf93a6717831a55add2d7a4', {
135
+ "fetchRemoteConfig": true,
136
+ "autocapture": {
137
+ "attribution": {
138
+ "excludeInternalReferrers": true,
139
+ },
140
+ "pageViews": true,
141
+ "sessions": true,
142
+ "formInteractions": true,
143
+ "fileDownloads": true,
144
+ "elementInteractions": true,
145
+ "pageUrlEnrichment": true,
146
+ "webVitals": true,
147
+ },
148
+ });
149
+
150
+ window.amplitude.add(window.engagement.plugin())
151
+
152
+ function checkAuthenticatedUser() {
153
+ try {
154
+ const AMP_PREFIX = 'AMP_';
155
+ const currUserId = amplitude.getUserId();
156
+
157
+ if (!currUserId) {
158
+ // Iterate through all amplitude cookies within amplitude domain
159
+ const amplitudeCookies = getCookies(AMP_PREFIX);
160
+
161
+ for (let [cookieName, cookieValue] of amplitudeCookies.map((cookies) => cookies.split('='))) {
162
+ const [deviceId, userId] = cookieValue.split('.');
163
+
164
+ try {
165
+ const userSession = JSON.parse(decodeURIComponent(atob(cookieValue)))
166
+ if (userSession && userSession.userId) {
167
+ amplitude.setUserId(userSession.userId);
168
+ break;
169
+ }
170
+ } catch {}
171
+ }
172
+ }
173
+ } catch (e) {
174
+ console.error(e);
175
+ }
176
+ }
177
+
178
+ function getCookies(prefix) {
179
+ try {
180
+ const cookieArray = document.cookie.split(';').map((c) => c.trimStart());
181
+ let values = [];
182
+ for (let cookie of cookieArray) {
183
+ while (cookie.charAt(0) === ' ') {
184
+ cookie = cookie.substring(1);
185
+ }
186
+ if (cookie.startsWith(prefix)) {
187
+ values.push(cookie.substring(name.length));
188
+ }
189
+ }
190
+ return values;
191
+ } catch (e) {
192
+ return [];
193
+ }
194
+ }
195
+
196
+ document.addEventListener("DOMContentLoaded", function () {
197
+ checkAuthenticatedUser();
198
+ });
199
+ </script>
200
+ <script>
201
+ function academyClick(link) {
202
+ amplitude.track('Academy link', {
203
+ 'destination': link,
204
+ '[Amplitude] Page URL': window.location.href
205
+ })
206
+ }
207
+ </script>
208
+ <!-- Preload consolidated glossary data -->
209
+
210
+
211
+ </head>
212
+ <body class="bg-gray-100 font-sans leading-normal text-gray-800 scroll-pt-24">
213
+ <div x-data="{ sidebarOpen: false }" class="container prose">
214
+ <div class="top-0 left-0 right-0 bg-white fixed z-10">
215
+ <div class="w-full pt-5 pl-5">
216
+ <div class="box-border">
217
+
218
+
219
+ <div class="box-border flex flex-row flex-nowrap items-center border-solid border-b border-black-200 h-12 px-4"
220
+ style="margin-left: -20px; margin-top: -20px;">
221
+ <div class="flex-auto mr-4"><a class="no-underline" href="/docs"><svg class="inline" xmlns="http://www.w3.org/2000/svg" width="102" height="22" viewBox="0 0 102 22" fill="none"><path d="M29.6006 4.30664L24.9824 15.8083H27.0328L27.9448 13.5064H32.8375L33.7338 15.8083H35.8324L31.222 4.30664H29.6006ZM28.6561 11.6698L30.3916 7.26636L32.1114 11.6698H28.6561Z" fill="#1E61F0"/><path d="M46.3273 7.61133C45.7724 7.61133 45.2618 7.7384 44.7934 7.99253C44.3251 8.24667 43.9778 8.59073 43.7515 9.02276C43.2724 8.08148 42.4381 7.61133 41.2486 7.61133C40.7695 7.61133 40.3081 7.71396 39.8643 7.9202C39.4206 8.12644 39.0615 8.45682 38.787 8.91036V7.77945H36.9541V15.8082H38.787V11.308C38.787 10.6668 38.9631 10.183 39.3153 9.85653C39.6676 9.53006 40.0916 9.36683 40.5865 9.36683C41.1355 9.36683 41.5684 9.53886 41.8862 9.8839C42.2039 10.2289 42.3623 10.703 42.3623 11.3071V15.8072H44.211V11.3071C44.211 10.6659 44.3861 10.182 44.7354 9.85555C45.0857 9.52908 45.5107 9.36585 46.0115 9.36585C46.5545 9.36585 46.9825 9.53788 47.2954 9.88292C47.6073 10.228 47.7637 10.702 47.7637 11.3061V15.8063H49.637V10.8975C49.637 9.89758 49.332 9.099 48.721 8.50276C48.11 7.90945 47.3121 7.61133 46.3273 7.61133Z" fill="#1E61F0"/><path d="M58.0913 8.17238C57.502 7.79802 56.8546 7.61133 56.1492 7.61133C55.5038 7.61133 54.9351 7.75013 54.4462 8.0287C53.9562 8.30727 53.5626 8.70509 53.2675 9.22412V7.78043H51.4346V18.6164H53.2675V14.3655C53.5636 14.8787 53.9562 15.2745 54.4462 15.5521C54.9361 15.8307 55.5038 15.9695 56.1492 15.9695C57.2206 15.9695 58.1297 15.5639 58.8784 14.7545C59.6261 13.9442 60 12.959 60 11.7987C60 11.0392 59.8288 10.3394 59.4874 9.6972C59.146 9.05502 58.6807 8.54675 58.0913 8.17238ZM57.4813 13.5181C57.0081 13.9911 56.4296 14.2277 55.7458 14.2277C55.0355 14.2277 54.4442 13.995 53.9739 13.5298C53.5026 13.0645 53.2675 12.4868 53.2675 11.7968C53.2675 11.0959 53.5026 10.5134 53.9739 10.0481C54.4452 9.58284 55.0355 9.35021 55.7458 9.35021C56.4296 9.35021 57.0081 9.58675 57.4813 10.0598C57.9556 10.5329 58.1917 11.1116 58.1917 11.7968C58.1927 12.4722 57.9556 13.045 57.4813 13.5181Z" fill="#1E61F0"/><path d="M63.287 4.30664H61.4541V15.8083H63.287V4.30664Z" fill="#1E61F0"/><path d="M66.9003 7.7793H65.0674V15.8081H66.9003V7.7793Z" fill="#1E61F0"/><path d="M65.996 4.04883C65.6733 4.04883 65.3959 4.16417 65.1647 4.39387C64.9335 4.62357 64.8174 4.89628 64.8174 5.21199C64.8174 5.53846 64.9325 5.81606 65.1647 6.04673C65.3959 6.27643 65.6733 6.39177 65.996 6.39177C66.3187 6.39177 66.5982 6.27643 66.8323 6.04673C67.0665 5.81703 67.1836 5.53846 67.1836 5.21199C67.1836 4.89628 67.0665 4.62357 66.8323 4.39387C66.5972 4.16417 66.3187 4.04883 65.996 4.04883Z" fill="#1E61F0"/><path d="M71.4538 5.62109H69.6051V7.77832H68.0713V9.51916H69.6051V12.7838C69.6051 13.7838 69.8737 14.554 70.4129 15.0936C70.951 15.6341 71.6751 15.9039 72.5842 15.9039C72.961 15.9039 73.2926 15.8716 73.5769 15.8071V14.1151C73.4107 14.1581 73.2109 14.1796 72.9797 14.1796C72.5055 14.1796 72.1336 14.0633 71.8621 13.8307C71.5905 13.5981 71.4538 13.2384 71.4538 12.7516V9.51916H73.5769V7.77832H71.4538V5.62109Z" fill="#1E61F0"/><path d="M80.6484 12.127C80.6484 12.7574 80.4673 13.2628 80.1033 13.643C79.7403 14.0223 79.2602 14.2129 78.662 14.2129C78.0697 14.2129 77.5935 14.0232 77.2324 13.643C76.8714 13.2638 76.6913 12.7584 76.6913 12.127V7.7793H74.8584V12.343C74.8584 13.471 75.1575 14.3575 75.7547 15.0017C76.3519 15.6458 77.1724 15.9684 78.2173 15.9684C78.7505 15.9684 79.2238 15.8452 79.638 15.5989C80.0522 15.3535 80.3886 15.0007 80.6474 14.5403V15.8081H82.496V7.7793H80.6474V12.127H80.6484Z" fill="#1E61F0"/><path d="M90.6406 9.19095C90.3445 8.68268 89.9549 8.29268 89.4699 8.01997C88.9858 7.74726 88.423 7.61139 87.7826 7.61139C87.0771 7.61139 86.4288 7.79613 85.8375 8.16463C85.2452 8.53313 84.7769 9.03847 84.4325 9.68065C84.0882 10.3228 83.916 11.0227 83.916 11.7822C83.916 12.5416 84.0882 13.2435 84.4325 13.8876C84.7769 14.5317 85.2452 15.04 85.8375 15.4114C86.4298 15.7829 87.0781 15.9686 87.7826 15.9686C88.423 15.9686 88.9858 15.8337 89.4699 15.5629C89.9539 15.2932 90.3445 14.9041 90.6406 14.3959V15.8073H92.4982V4.30664H90.6406V9.19095ZM89.9352 13.5269C89.464 13.9951 88.8786 14.2287 88.1791 14.2287C87.4953 14.2287 86.9168 13.9922 86.4435 13.5191C85.9693 13.046 85.7332 12.4674 85.7332 11.7822C85.7332 11.1087 85.9703 10.5349 86.4435 10.0619C86.9168 9.58877 87.4953 9.35223 88.1791 9.35223C88.8786 9.35223 89.464 9.58486 89.9352 10.0501C90.4065 10.5154 90.6416 11.0931 90.6416 11.7831C90.6406 12.4771 90.4055 13.0587 89.9352 13.5269Z" fill="#1E61F0"/><path d="M102 11.6218C102 10.8574 101.822 10.1664 101.466 9.54863C101.111 8.93088 100.633 8.45389 100.033 8.11667C99.4327 7.77945 98.7716 7.61133 98.0504 7.61133C97.286 7.61133 96.5854 7.79313 95.9469 8.15674C95.3094 8.52036 94.8057 9.01885 94.4367 9.65224C94.0678 10.2856 93.8838 10.9855 93.8838 11.7498C93.8838 12.5357 94.0678 13.2522 94.4367 13.8993C94.8057 14.5463 95.3104 15.0526 95.9509 15.4192C96.5914 15.7857 97.3017 15.9685 98.0829 15.9685C99.0785 15.9685 99.9256 15.7114 100.626 15.1983C101.326 14.6851 101.751 14.0058 101.902 13.1613H100.054C99.9729 13.5034 99.7535 13.782 99.3953 13.995C99.0372 14.2091 98.6112 14.3156 98.1153 14.3156C97.4749 14.3156 96.9505 14.1446 96.5412 13.8025C96.1319 13.4604 95.8682 12.9902 95.7502 12.3911H101.95C101.984 12.2474 102 11.9903 102 11.6218ZM95.7993 10.8271C95.9341 10.3345 96.189 9.95232 96.5668 9.67961C96.9436 9.4069 97.403 9.27006 97.9471 9.27006C98.4961 9.27006 98.9546 9.41374 99.3235 9.69916C99.6925 9.98555 99.9168 10.3609 99.9975 10.8262H95.7993V10.8271Z" fill="#1E61F0"/><path d="M9.3659 5.25304C9.30588 5.1768 9.24193 5.13477 9.16519 5.13477C9.1101 5.13868 9.05894 5.15627 9.01171 5.18559C8.44403 5.62642 7.6717 7.49628 7.03613 9.96336L7.59988 9.96727C8.70967 9.97998 9.85684 9.99269 10.9883 10.0093C10.6892 8.88133 10.4078 7.91463 10.1481 7.13072C9.76731 5.99101 9.51151 5.47785 9.3659 5.25304Z" fill="#1E61F0"/><path d="M10.6256 0.5C4.75792 0.5 0 5.22694 0 11.0564C0 16.886 4.75792 21.6129 10.6256 21.6129C16.4933 21.6129 21.2512 16.886 21.2512 11.0564C21.2512 5.22694 16.4933 0.5 10.6256 0.5ZM18.4689 10.9294C18.4394 11.0477 18.3666 11.163 18.2643 11.247C18.2515 11.2558 18.2387 11.2637 18.2259 11.2725L18.2131 11.2813L18.1875 11.2979L18.1659 11.3106C18.0852 11.3526 17.9947 11.3741 17.9012 11.3741H12.8659C12.9042 11.5393 12.9514 11.7299 12.9977 11.9342C13.2751 13.1169 14.0052 16.2623 14.7853 16.2623H14.8021H14.8109H14.8277C15.4337 16.2623 15.7456 15.3895 16.4284 13.4766L16.4372 13.4551C16.5484 13.1501 16.6724 12.8022 16.8042 12.4337L16.8386 12.3408C16.8898 12.2177 17.0305 12.1541 17.1545 12.2049C17.244 12.2392 17.3079 12.3281 17.3079 12.4259C17.3079 12.4513 17.304 12.4728 17.2991 12.4933L17.2696 12.5862C17.1968 12.8149 17.125 13.1247 17.0344 13.4854C16.6291 15.1559 16.0142 17.6787 14.444 17.6787H14.4312C13.4158 17.6699 12.8098 16.059 12.549 15.368C12.063 14.0787 11.696 12.7093 11.3419 11.379H6.71677L5.75653 14.4355L5.74374 14.4228C5.59911 14.6476 5.29608 14.715 5.0698 14.5714C4.92911 14.4824 4.84351 14.3299 4.84351 14.1647V14.1481L4.90353 13.8001C5.03536 13.0162 5.1977 12.1971 5.37676 11.3751H3.41397L3.40512 11.3663C3.0037 11.3067 2.72626 10.9343 2.78627 10.5355C2.8335 10.2256 3.07257 9.98028 3.37954 9.92456C3.45628 9.91576 3.53302 9.91185 3.60976 9.91576H3.70322C4.32207 9.92456 4.97928 9.93727 5.70438 9.94509C6.72464 5.82416 7.90625 3.72949 9.22067 3.72558C10.6286 3.72558 11.6744 6.90913 12.5107 10.0252L12.5146 10.0379C14.2305 10.0722 16.0653 10.123 17.8441 10.2501L17.9209 10.2588C17.9504 10.2588 17.976 10.2628 18.0065 10.2676H18.0153L18.0242 10.2716H18.0281C18.3321 10.3312 18.5328 10.6283 18.4689 10.9294Z" fill="#1E61F0"/></svg> <span class="hidden md:inline text-xs uppercase text-black-600 ml-2">documentation</span></a></div>
222
+ <div id="algolia-search-header"></div>
223
+ </div>
224
+
225
+ </div>
226
+ </div>
227
+
228
+ </div>
229
+ <div class="top-12 left-0 right-0 fixed bg-white z-10">
230
+ <div class="w-full overflow-scroll md:overflow-auto pt-5 pl-5">
231
+ <div class="box-border">
232
+
233
+ <div class="box-border flex flex-row flex-nowrap items-center border-solid border-b border-black-200 h-12 px-4 justify-start"
234
+ style="margin-left: -20px; margin-top: -20px;">
235
+
236
+
237
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/get-started">Get Started</a></div>
238
+
239
+
240
+
241
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/data">Data</a></div>
242
+
243
+
244
+
245
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/analytics">Analytics</a></div>
246
+
247
+
248
+
249
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/amplitude-ai">Amplitude AI</a></div>
250
+
251
+
252
+
253
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/session-replay">Session Replay</a></div>
254
+
255
+
256
+
257
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/guides-and-surveys">Guides and Surveys</a></div>
258
+
259
+
260
+
261
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/assistant">AI Assistant</a></div>
262
+
263
+
264
+
265
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/experiment-home">Experiment</a></div>
266
+
267
+
268
+
269
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/admin">Admin</a></div>
270
+
271
+
272
+
273
+ <div class="flex-initial mr-4 text-sm p-2 inline w-max" x-data="{ open: false }"><button
274
+ @click="open = !open" class="font-normal -mb-[11px] text-[#111827]">Developers <svg class="inline fill-[#111827]" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><g id="icon-chevron-down"><path id="Vector" d="M10.25 10.6338L13.8837 7L15 8.11625L10.25 12.8663L5.5 8.11625L6.61625 7L10.25 10.6338Z" fill="#5A5E68"/></g></svg></button>
275
+ <div x-cloak x-show="open" x-transition @click.outside="open = false" class="mt-4 py-2 right-4 sm:right-auto absolute border border-amp-gray-100 rounded flex flex-col shadow-lg top-4 bg-white w-48 p-4 font-normal z-20">
276
+
277
+ <a class="no-underline pl-4 py-2 font-light hover:bg-amp-blue-950 hover:rounded" href="/docs/sdks">SDKs</a>
278
+
279
+ <a class="no-underline pl-4 py-2 font-light hover:bg-amp-blue-950 hover:rounded" href="/docs/apis">APIs</a>
280
+
281
+ </div>
282
+ </div>
283
+
284
+
285
+
286
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/partners">Partners</a></div>
287
+
288
+
289
+
290
+ <div class="flex-initial mr-4 text-sm p-2 transition hover:bg-amp-blue-950 hover:rounded hover:p-2 relative"><a class="no-underline font-normal " href="/docs/faq">FAQ</a></div>
291
+
292
+
293
+ </div>
294
+
295
+
296
+ </div>
297
+ </div>
298
+
299
+ </div>
300
+
301
+ <div
302
+ class="w-64 top-24 bg-white bottom-0 border-solid border-r border-black-200 -left-60 lg:left-0 lg:translate-x-0 lg:block z-10 fixed transition shadow overflow-visible lg:overflow-auto lg:overscroll-contain" :class="{ 'translate-x-[240px]': sidebarOpen }">
303
+ <button @click="sidebarOpen = !sidebarOpen" class="absolute lg:hidden left-0 z-50 w-4 translate-x-[245px] translate-y-8" :class="{ 'rotate-180': sidebarOpen, 'translate-x-[250px]' : sidebarOpen }"><svg xmlns="http://www.w3.org/2000/svg" width="21" height="24" viewBox="0 0 21 24" fill="none"><rect x="0.5" y="0.5" width="20" height="23" rx="3.5" fill="white"/><rect x="0.5" y="0.5" width="20" height="23" rx="3.5" stroke="#DEDFE2"/><g clip-path="url(#clip0_671_1270)"><path d="M11.007 11.8L8.09998 8.893L8.99298 8L12.793 11.8L8.99298 15.6L8.09998 14.707L11.007 11.8Z" fill="#1E2024"/></g><defs><clipPath id="clip0_671_1270"><rect width="16" height="16" fill="white" transform="translate(2.5 4)"/></clipPath></defs></svg></button>
304
+ <div class="h-full overflow-scroll overscroll-contain">
305
+
306
+ <amp-side-nav current-uri="/docs/sdks/analytics/react-native/react-native-sdk" nav-title="analytics_sdks">
307
+
308
+
309
+
310
+
311
+ <amp-nav-item
312
+ title="Analytics SDKs"
313
+ url="/docs/sdks/analytics"
314
+ slug="analytics-sdks"
315
+ level="1"
316
+ >
317
+ </amp-nav-item>
318
+
319
+
320
+
321
+
322
+
323
+
324
+ <amp-nav-item
325
+ title="Browser"
326
+ slug="browser"
327
+ has-children
328
+ level="1">
329
+
330
+
331
+
332
+
333
+
334
+ <amp-nav-item
335
+ title="Browser Unified SDK"
336
+ url="/docs/sdks/analytics/browser/browser-unified-sdk"
337
+ slug="browser-unified-sdk"
338
+ parent-slug="browser"
339
+ level="2"
340
+ >
341
+ </amp-nav-item>
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <amp-nav-item
350
+ title="Browser SDK 2"
351
+ slug="browser-sdk-2"
352
+ parent-slug="browser"
353
+ has-children
354
+ level="2">
355
+
356
+
357
+ <amp-nav-item
358
+ title="Browser SDK 2"
359
+ url="/docs/sdks/analytics/browser/browser-sdk-2"
360
+ slug="browser-sdk-2"
361
+ parent-slug="browser-sdk-2"
362
+
363
+ level="3"
364
+ >
365
+ </amp-nav-item>
366
+
367
+
368
+ <amp-nav-item
369
+ title="Ampli for Browser SDK 2.0"
370
+ url="/docs/sdks/analytics/browser/ampli-for-browser-sdk-2-0"
371
+ slug="ampli-for-browser-sdk-20"
372
+ parent-slug="browser-sdk-2"
373
+
374
+ level="3"
375
+ >
376
+ </amp-nav-item>
377
+
378
+
379
+ <amp-nav-item
380
+ title="Migrate from Browser SDK 1.0 to 2.0"
381
+ url="/docs/sdks/analytics/browser/migrate-from-browser-sdk-1-0-to-2-0"
382
+ slug="migrate-from-browser-sdk-10-to-20"
383
+ parent-slug="browser-sdk-2"
384
+
385
+ level="3"
386
+ >
387
+ </amp-nav-item>
388
+
389
+
390
+ <amp-nav-item
391
+ title="Cookies and consent management (Browser SDK)"
392
+ url="/docs/sdks/analytics/browser/cookies-and-consent-management"
393
+ slug="cookies-and-consent-management-browser-sdk"
394
+ parent-slug="browser-sdk-2"
395
+
396
+ level="3"
397
+ >
398
+ </amp-nav-item>
399
+
400
+ </amp-nav-item>
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+ <amp-nav-item
409
+ title="Autocapture Plugin"
410
+ url="/docs/sdks/analytics/browser/autocapture-plugin"
411
+ slug="autocapture-plugin"
412
+ parent-slug="browser"
413
+ level="2"
414
+ >
415
+ </amp-nav-item>
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+ <amp-nav-item
424
+ title="Browser SDK 1"
425
+ slug="browser-sdk-1"
426
+ parent-slug="browser"
427
+ has-children
428
+ level="2">
429
+
430
+
431
+ <amp-nav-item
432
+ title="Browser SDK 1"
433
+ url="/docs/sdks/analytics/browser/browser-sdk-1"
434
+ slug="browser-sdk-1"
435
+ parent-slug="browser-sdk-1"
436
+
437
+ level="3"
438
+ >
439
+ </amp-nav-item>
440
+
441
+
442
+ <amp-nav-item
443
+ title="Ampli for Browser SDK 1.0"
444
+ url="/docs/sdks/analytics/browser/ampli-for-browser-sdk-1-0"
445
+ slug="ampli-for-browser-sdk-10"
446
+ parent-slug="browser-sdk-1"
447
+
448
+ level="3"
449
+ >
450
+ </amp-nav-item>
451
+
452
+ </amp-nav-item>
453
+
454
+
455
+
456
+ </amp-nav-item>
457
+
458
+
459
+
460
+
461
+
462
+ <amp-nav-item
463
+ title="Android"
464
+ slug="android"
465
+ has-children
466
+ level="1">
467
+
468
+
469
+
470
+
471
+
472
+ <amp-nav-item
473
+ title="Android-Kotlin SDK"
474
+ url="/docs/sdks/analytics/android/android-kotlin-sdk"
475
+ slug="android-kotlin-sdk"
476
+ parent-slug="android"
477
+ level="2"
478
+ >
479
+ </amp-nav-item>
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+ <amp-nav-item
488
+ title="Ampli for Android-Kotlin SDK"
489
+ url="/docs/sdks/analytics/android/ampli-for-android-kotlin-sdk"
490
+ slug="ampli-for-android-kotlin-sdk"
491
+ parent-slug="android"
492
+ level="2"
493
+ >
494
+ </amp-nav-item>
495
+
496
+
497
+
498
+ </amp-nav-item>
499
+
500
+
501
+
502
+
503
+
504
+ <amp-nav-item
505
+ title="Node"
506
+ slug="node"
507
+ has-children
508
+ level="1">
509
+
510
+
511
+
512
+
513
+
514
+ <amp-nav-item
515
+ title="Node.js SDK"
516
+ url="/docs/sdks/analytics/node/node-js-sdk"
517
+ slug="nodejs-sdk"
518
+ parent-slug="node"
519
+ level="2"
520
+ >
521
+ </amp-nav-item>
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+ <amp-nav-item
530
+ title="Node.js Ampli Wrapper"
531
+ url="/docs/sdks/analytics/node/node-js-ampli-wrapper"
532
+ slug="nodejs-ampli-wrapper"
533
+ parent-slug="node"
534
+ level="2"
535
+ >
536
+ </amp-nav-item>
537
+
538
+
539
+
540
+ </amp-nav-item>
541
+
542
+
543
+
544
+
545
+
546
+ <amp-nav-item
547
+ title="Go"
548
+ slug="go"
549
+ has-children
550
+ level="1">
551
+
552
+
553
+
554
+
555
+
556
+ <amp-nav-item
557
+ title="Go SDK"
558
+ url="/docs/sdks/analytics/go/go-sdk"
559
+ slug="go-sdk"
560
+ parent-slug="go"
561
+ level="2"
562
+ >
563
+ </amp-nav-item>
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+ <amp-nav-item
572
+ title="Ampli for Go"
573
+ url="/docs/sdks/analytics/go/ampli-for-go"
574
+ slug="ampli-for-go"
575
+ parent-slug="go"
576
+ level="2"
577
+ >
578
+ </amp-nav-item>
579
+
580
+
581
+
582
+ </amp-nav-item>
583
+
584
+
585
+
586
+
587
+
588
+ <amp-nav-item
589
+ title="Python"
590
+ slug="python"
591
+ has-children
592
+ level="1">
593
+
594
+
595
+
596
+
597
+
598
+ <amp-nav-item
599
+ title="Python SDK"
600
+ url="/docs/sdks/analytics-sdks/python/python-sdk"
601
+ slug="python-sdk"
602
+ parent-slug="python"
603
+ level="2"
604
+ >
605
+ </amp-nav-item>
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+ <amp-nav-item
614
+ title="Ampli for Python SDK"
615
+ url="/docs/sdks/analytics-sdks/python/ampli-for-python-sdk"
616
+ slug="ampli-for-python-sdk"
617
+ parent-slug="python"
618
+ level="2"
619
+ >
620
+ </amp-nav-item>
621
+
622
+
623
+
624
+ </amp-nav-item>
625
+
626
+
627
+
628
+
629
+
630
+ <amp-nav-item
631
+ title="iOS"
632
+ slug="ios"
633
+ has-children
634
+ level="1">
635
+
636
+
637
+
638
+
639
+
640
+ <amp-nav-item
641
+ title="iOS Swift SDK"
642
+ url="/docs/sdks/analytics/ios/ios-swift-sdk"
643
+ slug="ios-swift-sdk"
644
+ parent-slug="ios"
645
+ level="2"
646
+ >
647
+ </amp-nav-item>
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+ <amp-nav-item
656
+ title="Ampli for iOS Swift SDK"
657
+ url="/docs/sdks/analytics/ios/ampli-for-ios-swift-sdk"
658
+ slug="ampli-for-ios-swift-sdk"
659
+ parent-slug="ios"
660
+ level="2"
661
+ >
662
+ </amp-nav-item>
663
+
664
+
665
+
666
+
667
+
668
+
669
+
670
+ <amp-nav-item
671
+ title="Unified SDK for Swift"
672
+ url="/docs/sdks/analytics/ios/unified-sdk"
673
+ slug="unified-sdk-for-swift"
674
+ parent-slug="ios"
675
+ level="2"
676
+ >
677
+ </amp-nav-item>
678
+
679
+
680
+
681
+ </amp-nav-item>
682
+
683
+
684
+
685
+
686
+
687
+ <amp-nav-item
688
+ title="Flutter"
689
+ slug="flutter"
690
+ has-children
691
+ level="1">
692
+
693
+
694
+
695
+
696
+
697
+ <amp-nav-item
698
+ title="Flutter SDK 3"
699
+ url="/docs/sdks/analytics/flutter/flutter-sdk"
700
+ slug="flutter-sdk-3"
701
+ parent-slug="flutter"
702
+ level="2"
703
+ >
704
+ </amp-nav-item>
705
+
706
+
707
+
708
+
709
+
710
+
711
+
712
+ <amp-nav-item
713
+ title="Flutter SDK 4"
714
+ url="/docs/sdks/analytics/flutter/flutter-sdk-4"
715
+ slug="flutter-sdk-4"
716
+ parent-slug="flutter"
717
+ level="2"
718
+ >
719
+ </amp-nav-item>
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+ <amp-nav-item
728
+ title="Flutter SDK 4.0 Migration Guide"
729
+ url="/docs/sdks/analytics/flutter/flutter-sdk-4-0-migration-guide"
730
+ slug="flutter-sdk-40-migration-guide"
731
+ parent-slug="flutter"
732
+ level="2"
733
+ >
734
+ </amp-nav-item>
735
+
736
+
737
+
738
+ </amp-nav-item>
739
+
740
+
741
+
742
+
743
+
744
+ <amp-nav-item
745
+ title="Java"
746
+ slug="java"
747
+ has-children
748
+ level="1">
749
+
750
+
751
+
752
+
753
+
754
+ <amp-nav-item
755
+ title="JRE Java SDK"
756
+ url="/docs/sdks/analytics/java/jre-java-sdk"
757
+ slug="jre-java-sdk"
758
+ parent-slug="java"
759
+ level="2"
760
+ >
761
+ </amp-nav-item>
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+ <amp-nav-item
770
+ title="Ampli for Java SDK"
771
+ url="/docs/sdks/analytics/java/ampli-for-java-sdk"
772
+ slug="ampli-for-java-sdk"
773
+ parent-slug="java"
774
+ level="2"
775
+ >
776
+ </amp-nav-item>
777
+
778
+
779
+
780
+ </amp-nav-item>
781
+
782
+
783
+
784
+
785
+
786
+ <amp-nav-item
787
+ title="React Native"
788
+ slug="react-native"
789
+ has-children
790
+ level="1">
791
+
792
+
793
+
794
+
795
+
796
+ <amp-nav-item
797
+ title="React Native SDK"
798
+ url="/docs/sdks/analytics/react-native/react-native-sdk"
799
+ slug="react-native-sdk"
800
+ parent-slug="react-native"
801
+ level="2"
802
+ is-current>
803
+ </amp-nav-item>
804
+
805
+
806
+
807
+
808
+
809
+
810
+
811
+ <amp-nav-item
812
+ title="Migrate to the latest React Native SDK"
813
+ url="/docs/sdks/analytics/react-native/migrate-to-the-latest-react-native-sdk"
814
+ slug="migrate-to-the-latest-react-native-sdk"
815
+ parent-slug="react-native"
816
+ level="2"
817
+ >
818
+ </amp-nav-item>
819
+
820
+
821
+
822
+
823
+
824
+
825
+
826
+ <amp-nav-item
827
+ title="Ampli for the React Native SDK"
828
+ url="/docs/sdks/analytics/react-native/ampli-for-the-react-native-sdk"
829
+ slug="ampli-for-the-react-native-sdk"
830
+ parent-slug="react-native"
831
+ level="2"
832
+ >
833
+ </amp-nav-item>
834
+
835
+
836
+
837
+ </amp-nav-item>
838
+
839
+
840
+
841
+
842
+
843
+ <amp-nav-item
844
+ title="Unreal"
845
+ slug="unreal"
846
+ has-children
847
+ level="1">
848
+
849
+
850
+
851
+
852
+
853
+ <amp-nav-item
854
+ title="Unreal SDK"
855
+ url="/docs/sdks/analytics/unreal/unreal-sdk"
856
+ slug="unreal-sdk"
857
+ parent-slug="unreal"
858
+ level="2"
859
+ >
860
+ </amp-nav-item>
861
+
862
+
863
+
864
+ </amp-nav-item>
865
+
866
+
867
+
868
+
869
+
870
+ <amp-nav-item
871
+ title="Unity"
872
+ slug="unity"
873
+ has-children
874
+ level="1">
875
+
876
+
877
+
878
+
879
+
880
+ <amp-nav-item
881
+ title="Unity SDK"
882
+ url="/docs/sdks/analytics/unity/unity-sdk"
883
+ slug="unity-sdk"
884
+ parent-slug="unity"
885
+ level="2"
886
+ >
887
+ </amp-nav-item>
888
+
889
+
890
+
891
+ </amp-nav-item>
892
+
893
+
894
+
895
+
896
+
897
+ <amp-nav-item
898
+ title="Maintenance SDKs"
899
+ slug="maintenance-sdks"
900
+ has-children
901
+ level="1">
902
+
903
+
904
+
905
+
906
+
907
+ <amp-nav-item
908
+ title="Marketing Analytics SDK"
909
+ slug="marketing-analytics-sdk"
910
+ parent-slug="maintenance-sdks"
911
+ has-children
912
+ level="2">
913
+
914
+
915
+ <amp-nav-item
916
+ title="Marketing Analytics SDK"
917
+ url="/docs/sdks/analytics/browser/marketing-analytics-sdk"
918
+ slug="marketing-analytics-sdk"
919
+ parent-slug="marketing-analytics-sdk"
920
+
921
+ level="3"
922
+ >
923
+ </amp-nav-item>
924
+
925
+
926
+ <amp-nav-item
927
+ title="Migrate from Marketing Analytics to Browser SDK 2.0"
928
+ url="/docs/sdks/analytics/browser/migrate-from-marketing-analytics-to-browser-sdk-2-0"
929
+ slug="migrate-from-marketing-analytics-to-browser-sdk-20"
930
+ parent-slug="marketing-analytics-sdk"
931
+
932
+ level="3"
933
+ >
934
+ </amp-nav-item>
935
+
936
+ </amp-nav-item>
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+ <amp-nav-item
945
+ title="Javascript SDK"
946
+ slug="javascript-sdk"
947
+ parent-slug="maintenance-sdks"
948
+ has-children
949
+ level="2">
950
+
951
+
952
+ <amp-nav-item
953
+ title="Javascript SDK"
954
+ url="/docs/sdks/analytics/browser/javascript-sdk"
955
+ slug="javascript-sdk"
956
+ parent-slug="javascript-sdk"
957
+
958
+ level="3"
959
+ >
960
+ </amp-nav-item>
961
+
962
+
963
+ <amp-nav-item
964
+ title="Ampli for Javascript SDK"
965
+ url="/docs/sdks/analytics/browser/ampli-for-javascript-sdk"
966
+ slug="ampli-for-javascript-sdk"
967
+ parent-slug="javascript-sdk"
968
+
969
+ level="3"
970
+ >
971
+ </amp-nav-item>
972
+
973
+
974
+ <amp-nav-item
975
+ title="Migrate from Javascript SDK to Browser SDK 1.0"
976
+ url="/docs/sdks/analytics/browser/migrate-from-javascript-sdk-to-browser-sdk-1-0"
977
+ slug="migrate-from-javascript-sdk-to-browser-sdk-10"
978
+ parent-slug="javascript-sdk"
979
+
980
+ level="3"
981
+ >
982
+ </amp-nav-item>
983
+
984
+
985
+ <amp-nav-item
986
+ title="Migrate from Javascript SDK to Browser SDK 2.0"
987
+ url="/docs/sdks/analytics/browser/migrate-from-javascript-sdk-to-browser-sdk-2-0"
988
+ slug="migrate-from-javascript-sdk-to-browser-sdk-20"
989
+ parent-slug="javascript-sdk"
990
+
991
+ level="3"
992
+ >
993
+ </amp-nav-item>
994
+
995
+
996
+ <amp-nav-item
997
+ title="Cookies and Consent Management (JavaScript SDK)"
998
+ url="/docs/sdks/analytics/browser/cookies-and-consent-management-javascript-sdk"
999
+ slug="cookies-and-consent-management-javascript-sdk"
1000
+ parent-slug="javascript-sdk"
1001
+
1002
+ level="3"
1003
+ >
1004
+ </amp-nav-item>
1005
+
1006
+ </amp-nav-item>
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+
1013
+
1014
+ <amp-nav-item
1015
+ title="React Native SDK (maintenance)"
1016
+ url="/docs/sdks/analytics/react-native/react-native-sdk-maintenance"
1017
+ slug="react-native-sdk-maintenance"
1018
+ parent-slug="maintenance-sdks"
1019
+ level="2"
1020
+ >
1021
+ </amp-nav-item>
1022
+
1023
+
1024
+
1025
+
1026
+
1027
+
1028
+
1029
+ <amp-nav-item
1030
+ title="iOS SDK"
1031
+ url="/docs/sdks/analytics/ios/ios-sdk"
1032
+ slug="ios-sdk"
1033
+ parent-slug="maintenance-sdks"
1034
+ level="2"
1035
+ >
1036
+ </amp-nav-item>
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+ <amp-nav-item
1045
+ title="Node SDK"
1046
+ slug="node-sdk"
1047
+ parent-slug="maintenance-sdks"
1048
+ has-children
1049
+ level="2">
1050
+
1051
+
1052
+ <amp-nav-item
1053
+ title="Node SDK"
1054
+ url="/docs/sdks/analytics/node/node-sdk"
1055
+ slug="node-sdk"
1056
+ parent-slug="node-sdk"
1057
+
1058
+ level="3"
1059
+ >
1060
+ </amp-nav-item>
1061
+
1062
+
1063
+ <amp-nav-item
1064
+ title="Ampli for Node SDK"
1065
+ url="/docs/sdks/analytics/node/ampli-for-node-sdk"
1066
+ slug="ampli-for-node-sdk"
1067
+ parent-slug="node-sdk"
1068
+
1069
+ level="3"
1070
+ >
1071
+ </amp-nav-item>
1072
+
1073
+
1074
+ <amp-nav-item
1075
+ title="Node.js SDK Migration Guide"
1076
+ url="/docs/sdks/analytics/node/node-js-sdk-migration-guide"
1077
+ slug="nodejs-sdk-migration-guide"
1078
+ parent-slug="node-sdk"
1079
+
1080
+ level="3"
1081
+ >
1082
+ </amp-nav-item>
1083
+
1084
+ </amp-nav-item>
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+ <amp-nav-item
1093
+ title="Android SDK 1.0"
1094
+ slug="android-sdk-10"
1095
+ parent-slug="maintenance-sdks"
1096
+ has-children
1097
+ level="2">
1098
+
1099
+
1100
+ <amp-nav-item
1101
+ title="Android SDK"
1102
+ url="/docs/sdks/analytics/android/android-sdk"
1103
+ slug="android-sdk"
1104
+ parent-slug="android-sdk-10"
1105
+
1106
+ level="3"
1107
+ >
1108
+ </amp-nav-item>
1109
+
1110
+
1111
+ <amp-nav-item
1112
+ title="Migrate to the Android-Kotlin SDK"
1113
+ url="/docs/sdks/analytics/android/migrate-to-the-android-kotlin-sdk"
1114
+ slug="migrate-to-the-android-kotlin-sdk"
1115
+ parent-slug="android-sdk-10"
1116
+
1117
+ level="3"
1118
+ >
1119
+ </amp-nav-item>
1120
+
1121
+ </amp-nav-item>
1122
+
1123
+
1124
+
1125
+ </amp-nav-item>
1126
+
1127
+
1128
+ </amp-side-nav>
1129
+
1130
+ </div>
1131
+
1132
+ </div>
1133
+ <div class="absolute top-24 left-0 lg:left-64 bottom-0 right-0 z-0 transition">
1134
+ <div class="max-w-screen-xl pt-8 mx-auto">
1135
+ <section class="w-full flex flex-col items-center">
1136
+ <div class="flex flex-row flex-nowrap w-full text-sm pl-6 lg:pl-8 text-gray-400">
1137
+
1138
+ <div class="mr-2 text-s text-gray-500 "><a class=""
1139
+ href="/docs/sdks">SDKs</a></div>
1140
+ <span class="mr-2">/</span><div class="mr-2 text-s text-gray-500 "><a class=""
1141
+ href="/docs/sdks/analytics">Amplitude Analytics SDK Catalog</a></div>
1142
+ <span class="mr-2">/</span><div class="mr-2 text-s text-gray-500 "><a class=""
1143
+ href="/docs/sdks/analytics/react-native">React Native</a></div>
1144
+ <span class="mr-2">/</span><div class="mr-2 text-s text-gray-500 "><a class="font-semibold"
1145
+ href="/docs/sdks/analytics/react-native/react-native-sdk">React Native SDK</a></div>
1146
+
1147
+
1148
+ </div>
1149
+ <div class="flex flex-row w-full pt-8 px-6 lg:p-8">
1150
+ <div class="copy w-full">
1151
+ <div class="flex flex-row items-start justify-between">
1152
+ <h1 class="font-[Gellix] font-normal mb-5 max-w-3xl">React Native SDK</h1>
1153
+ </div>
1154
+ <div
1155
+ class="prose prose-a:text-amp-blue prose-ol:list-decimal prose-ol:list-outside prose-pre:bg-[#fafafa] max-w-prose" data-headings-anchors data-math-root>
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+ <p>The React Native SDK lets you send events to Amplitude.</p>
1165
+ <p>
1166
+ <div class="hint note"><h2 class="hint-title">React Native support</h2><div class="hint-content">
1167
+ Because <a href="https://github.com/facebook/react-native">React-Native</a> doesn't provide stable release versioning, ensuring backward compatibility is challenging. Additionally, React-Native itself isn't backward compatible and may introduce breaking changes across different versions. Check the React-Native <a href="https://github.com/react-native-community/cli#compatibility">compatibility list</a> for more details. Amplitude supports only the latest version of React-Native.</div></div>
1168
+ </p>
1169
+ <h2 id="compatibility-matrix">Compatibility matrix<a href="#compatibility-matrix" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1170
+ <p>The following matrix lists the support for Amplitude React Native SDK version for <a href="https://github.com/react-native-community/cli">different versions of React Native and React Native CLI</a>.</p>
1171
+ <table>
1172
+ <thead>
1173
+ <tr>
1174
+ <th>@amplitude/analytics-react-native</th>
1175
+ <th>react-native</th>
1176
+ <th>Gradle</th>
1177
+ <th>Android Gradle Plugin</th>
1178
+ </tr>
1179
+ </thead>
1180
+ <tbody>
1181
+ <tr>
1182
+ <td>&gt;= 1.4.0</td>
1183
+ <td>&gt;= 0.68</td>
1184
+ <td>7.5.1+</td>
1185
+ <td>7.2.1+</td>
1186
+ </tr>
1187
+ <tr>
1188
+ <td>&gt;= 1.0.0, &lt;= 1.3.6</td>
1189
+ <td>&gt;= 0.61, &lt;= 0.70</td>
1190
+ <td>3.5.3+</td>
1191
+ <td>3.5.3+</td>
1192
+ </tr>
1193
+ </tbody>
1194
+ </table>
1195
+ <p>Learn more about the Android <a href="https://developer.android.com/studio/releases/gradle-plugin#updating-gradle">Gradle Plugin compatibility</a>.</p>
1196
+ <h2 id="install-the-sdk">Install the SDK<a href="#install-the-sdk" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1197
+ <p>To get started with using Amplitude React Native SDK, install the package to your project with npm. You must also install <code>@react-native-async-storage/async-storage</code> for the SDK to work as expected.</p>
1198
+ <p>
1199
+ <div class="hint tip"><h2 class="hint-title">Web and Expo support</h2><div class="hint-content">
1200
+ This SDK can be used for react-native apps built for web or built using <a href="https://expo.dev/">Expo</a> (Expo Go not yet supported).</div></div>
1201
+ </p>
1202
+ <p>
1203
+ <div class="border border-amp-gray-200 rounded" x-data="{ activeTab: 'npm' }">
1204
+ <div class="flex space-x-1 border-amp-gray-200 border-b border-solid">
1205
+ <button x-on:click="activeTab = 'npm'" :class="{'border-b-2 border-amp-blue-500 text-amp-blue-500 -mb-[2px]' : activeTab === 'npm', 'bg-gray-200': activeTab !== 'npm'}" class="px-4 py-2">npm</button><button x-on:click="activeTab = 'yarn'" :class="{'border-b-2 border-amp-blue-500 text-amp-blue-500 -mb-[2px]' : activeTab === 'yarn', 'bg-gray-200': activeTab !== 'yarn'}" class="px-4 py-2">yarn</button><button x-on:click="activeTab = 'expo'" :class="{'border-b-2 border-amp-blue-500 text-amp-blue-500 -mb-[2px]' : activeTab === 'expo', 'bg-gray-200': activeTab !== 'expo'}" class="px-4 py-2">expo</button></div>
1206
+
1207
+ <div x-cloak x-show="activeTab === 'npm'" class="p-4 tab"></p>
1208
+ <pre><code class="language-bash">npm install @amplitude/analytics-react-native
1209
+ npm install @react-native-async-storage/async-storage
1210
+ </code></pre>
1211
+ <p>
1212
+ </div>
1213
+ <div x-cloak x-show="activeTab === 'yarn'" class="p-4 tab"></p>
1214
+ <pre><code class="language-bash">yarn add @amplitude/analytics-react-native
1215
+ yarn add @react-native-async-storage/async-storage
1216
+ </code></pre>
1217
+ <p>
1218
+ </div>
1219
+ <div x-cloak x-show="activeTab === 'expo'" class="p-4 tab"></p>
1220
+ <pre><code class="language-bash">expo install @amplitude/analytics-react-native
1221
+ expo install @react-native-async-storage/async-storage
1222
+ </code></pre>
1223
+ <p>
1224
+ </div>
1225
+ </div></p>
1226
+ <p>Install the native modules to run the SDK on iOS.</p>
1227
+ <pre><code class="language-bash">cd ios
1228
+ pod install
1229
+ </code></pre>
1230
+ <h2 id="initialize-the-sdk">Initialize the SDK<a href="#initialize-the-sdk" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1231
+ <p>Initialization is necessary before any instrumentation is done. The API key for your Amplitude project is required. Optionally, a user ID and config object can be passed in this call. The SDK can be used anywhere after it's initialized anywhere in an application.</p>
1232
+ <pre><code class="language-ts">import { init } from '@amplitude/analytics-react-native';
1233
+
1234
+ // Option 1, initialize with API_KEY only
1235
+ init(API_KEY);
1236
+
1237
+ // Option 2, initialize including user ID if it's already known
1238
+ init(API_KEY, 'user@amplitude.com');
1239
+
1240
+ // Option 3, initialize including configuration
1241
+ init(API_KEY, 'user@amplitude.com', {
1242
+ disableCookies: true, // Disables the use of browser cookies
1243
+ });
1244
+ </code></pre>
1245
+ <h2 id="configure-the-sdk">Configure the SDK<a href="#configure-the-sdk" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1246
+ <p>
1247
+ <div class="hint note"><h2 class="hint-title">Web vs. mobile</h2><div class="hint-content">
1248
+ The configuration of the SDK is shared across web and mobile platforms. However, many of these options simply don't apply when running the SDK on native platforms (for example iOS, Android). For example, when the SDK is run on web, the identity is stored in the browser cookie by default, whereas on native platforms identity is stored in async storage.</div></div>
1249
+ </p>
1250
+ <p><details x-data="{ expanded: false}"
1251
+ class="border rounded-md border-amp-light-blue-500 bg-amp-light-blue-900 relative cursor-pointer"
1252
+ @click="expanded = !expanded">
1253
+ <summary class="flex relative"><span class="w-full font-semibold text-sm summary-name m-4">Configuration options</span><span
1254
+ class="transform -translate-y-1/2 transistion duration-100 absolute right-4 top-1/2" x-ref="animatedItem"
1255
+ :class="{'rotate-90': expanded, 'rotate-0': !expanded}">
1256
+ <svg class="rotate-[270deg]" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><g id="icon-chevron-down"><path id="Vector" d="M10.25 10.6338L13.8837 7L15 8.11625L10.25 12.8663L5.5 8.11625L6.61625 7L10.25 10.6338Z" fill="#5A5E68"/></g></svg></span></summary>
1257
+ <div @click.stop class="p-4 mt-4 bg-white overflow-x-scroll detail"></p>
1258
+ <table>
1259
+ <thead>
1260
+ <tr>
1261
+ <th>Name</th>
1262
+ <th>Description</th>
1263
+ <th>Default Value</th>
1264
+ </tr>
1265
+ </thead>
1266
+ <tbody>
1267
+ <tr>
1268
+ <td><code>instanceName</code></td>
1269
+ <td><code>string</code>. The instance name.</td>
1270
+ <td><code>$default_instance</code></td>
1271
+ </tr>
1272
+ <tr>
1273
+ <td><code>flushIntervalMillis</code></td>
1274
+ <td><code>number</code>. Sets the interval of uploading events to Amplitude in milliseconds.</td>
1275
+ <td>1,000 (1 second)</td>
1276
+ </tr>
1277
+ <tr>
1278
+ <td><code>flushQueueSize</code></td>
1279
+ <td><code>number</code>. Sets the maximum number of events that are batched in a single upload attempt.</td>
1280
+ <td>30 events</td>
1281
+ </tr>
1282
+ <tr>
1283
+ <td><code>flushMaxRetries</code></td>
1284
+ <td><code>number</code>. Sets the maximum number of retries for failed upload attempts. This is only applicable to retryable errors.</td>
1285
+ <td>5 times.</td>
1286
+ </tr>
1287
+ <tr>
1288
+ <td><code>logLevel</code></td>
1289
+ <td><code>LogLevel.None</code> or <code>LogLevel.Error</code> or <code>LogLevel.Warn</code> or <code>LogLevel.Verbose</code> or <code>LogLevel.Debug</code>. Sets the log level.</td>
1290
+ <td><code>LogLevel.Warn</code></td>
1291
+ </tr>
1292
+ <tr>
1293
+ <td><code>loggerProvider </code></td>
1294
+ <td><code>Logger</code>. Sets a custom <code>loggerProvider</code> class from the Logger to emit log messages to desired destination.</td>
1295
+ <td><code>Amplitude Logger</code></td>
1296
+ </tr>
1297
+ <tr>
1298
+ <td><code>minIdLength</code></td>
1299
+ <td><code>number</code>. Sets the minimum length for the value of <code>userId</code> and <code>deviceId</code> properties.</td>
1300
+ <td><code>5</code></td>
1301
+ </tr>
1302
+ <tr>
1303
+ <td><code>optOut</code></td>
1304
+ <td><code>boolean</code>. Sets permission to track events. Setting a value of <code>true</code> prevents Amplitude from tracking and uploading events.</td>
1305
+ <td><code>false</code></td>
1306
+ </tr>
1307
+ <tr>
1308
+ <td><code>serverUrl</code></td>
1309
+ <td><code>string</code>. Sets the URL where events are upload to.</td>
1310
+ <td><code>https://api2.amplitude.com/2/httpapi</code></td>
1311
+ </tr>
1312
+ <tr>
1313
+ <td><code>serverZone</code></td>
1314
+ <td><code>EU</code> or <code>US</code>. Sets the Amplitude server zone. Set this to <code>EU</code> for Amplitude projects created in <code>EU</code> data center.</td>
1315
+ <td><code>US</code></td>
1316
+ </tr>
1317
+ <tr>
1318
+ <td><code>useBatch</code></td>
1319
+ <td><code>boolean</code>. Sets whether to upload events to Batch API instead of the default HTTP V2 API or not.</td>
1320
+ <td><code>false</code></td>
1321
+ </tr>
1322
+ <tr>
1323
+ <td><code>appVersion</code></td>
1324
+ <td><code>string</code>. Sets an app version for events tracked. This can be the version of your application. For example: &quot;1.0.0&quot;</td>
1325
+ <td><code>undefined</code></td>
1326
+ </tr>
1327
+ <tr>
1328
+ <td><code>deviceId</code></td>
1329
+ <td><code>string</code>. Sets an identifier for the device running your application.</td>
1330
+ <td><code>UUID()</code></td>
1331
+ </tr>
1332
+ <tr>
1333
+ <td><code>cookieExpiration</code></td>
1334
+ <td><code>number</code>. Sets expiration of cookies created in days.</td>
1335
+ <td>365 days</td>
1336
+ </tr>
1337
+ <tr>
1338
+ <td><code>cookieSameSite</code></td>
1339
+ <td><code>string</code>. Sets <code>SameSite</code> property of cookies created.</td>
1340
+ <td><code>Lax</code></td>
1341
+ </tr>
1342
+ <tr>
1343
+ <td><code>cookieSecure</code></td>
1344
+ <td><code>boolean</code>. Sets <code>Secure</code> property of cookies created.</td>
1345
+ <td><code>false</code></td>
1346
+ </tr>
1347
+ <tr>
1348
+ <td><code>cookieStorage</code></td>
1349
+ <td><code>Storage&lt;UserSession&gt;</code>. Sets a custom implementation of <code>Storage&lt;UserSession&gt;</code> to persist user identity.</td>
1350
+ <td><code>MemoryStorage&lt;UserSession&gt;</code></td>
1351
+ </tr>
1352
+ <tr>
1353
+ <td><code>cookieUpgrade</code></td>
1354
+ <td><code>boolean</code>. Sets upgrading from cookies created by <a href="/docs/sdks/analytics/browser/javascript-sdk">maintenance Browser SDK</a>. If true, new Browser SDK deletes cookies created by maintenance Browser SDK. If false, Browser SDK keeps cookies created by maintenance Browser SDK.</td>
1355
+ <td><code>true</code></td>
1356
+ </tr>
1357
+ <tr>
1358
+ <td><code>disableCookies</code></td>
1359
+ <td><code>boolean</code>. Sets permission to use cookies. If value is <code>true</code>, localStorage API is used to persist user identity.</td>
1360
+ <td>The cookies is enable by default.</td>
1361
+ </tr>
1362
+ <tr>
1363
+ <td><code>domain</code></td>
1364
+ <td><code>string</code>. Sets the domain property of cookies created.</td>
1365
+ <td><code>undefined</code></td>
1366
+ </tr>
1367
+ <tr>
1368
+ <td><code>partnerId</code></td>
1369
+ <td><code>string</code>. Sets partner ID. Amplitude requires the customer who built an event ingestion integration to add the partner identifier to <code>partner_id</code>.</td>
1370
+ <td><code>undefined</code></td>
1371
+ </tr>
1372
+ <tr>
1373
+ <td><code>sessionTimeout</code></td>
1374
+ <td><code>number</code>. Sets the period of inactivity from the last tracked event before a session expires in milliseconds.</td>
1375
+ <td>1,800,000 milliseconds (30 minutes)</td>
1376
+ </tr>
1377
+ <tr>
1378
+ <td><code>userId</code></td>
1379
+ <td><code>number</code>. Sets an identifier for the user being tracked. Must have a minimum length of 5 characters unless overridden with the <code>minIdLength</code> option.</td>
1380
+ <td><code>undefined</code></td>
1381
+ </tr>
1382
+ <tr>
1383
+ <td><code>trackingOptions</code></td>
1384
+ <td><code>TrackingOptions</code>. Configures tracking of additional properties. Please refer to <code>Optional tracking</code> section for more information.</td>
1385
+ <td>Enable all tracking options by default.</td>
1386
+ </tr>
1387
+ <tr>
1388
+ <td><code>storageProvider</code></td>
1389
+ <td><code>Storage&lt;Event[]&gt;</code>. Implements a custom <code>storageProvider</code> class from Storage.</td>
1390
+ <td><code>MemoryStorage</code></td>
1391
+ </tr>
1392
+ <tr>
1393
+ <td><code>trackingSessionEvents</code></td>
1394
+ <td><code>boolean</code>. Whether to automatically log start and end session events corresponding to the start and end of a user's session.</td>
1395
+ <td><code>false</code></td>
1396
+ </tr>
1397
+ <tr>
1398
+ <td><code>migrateLegacyData</code></td>
1399
+ <td><code>boolean</code>. Available in <code>1.3.4</code>+. Whether to migrate <a href="/docs/sdks/analytics/react-native/react-native-sdk-maintenance">maintenance SDK</a> data (events, user/device ID).</td>
1400
+ <td><code>true</code></td>
1401
+ </tr>
1402
+ </tbody>
1403
+ </table>
1404
+ <p>
1405
+ </div>
1406
+ </details></p>
1407
+ <h3 id="configure-batching-behavior">Configure batching behavior<a href="#configure-batching-behavior" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1408
+ <p>To support high-performance environments, the SDK sends events in batches. Every event logged by the <code>track</code> method is queued in memory. Events are flushed in batches in background. You can customize batch behavior with <code>flushQueueSize</code> and <code>flushIntervalMillis</code>. By default, the serverUrl will be <code>https://api2.amplitude.com/2/httpapi</code>. For customers who want to send large batches of data at a time, set <code>useBatch</code> to <code>true</code> to set <code>setServerUrl</code> to batch event upload API <code>https://api2.amplitude.com/batch</code>. Both the regular mode and the batch mode use the same events upload threshold and flush time intervals.</p>
1409
+ <pre><code class="language-ts">import * as amplitude from '@amplitude/analytics-react-native';
1410
+
1411
+ amplitude.init(API_KEY, OPTIONAL_USER_ID, {
1412
+ // Events queued in memory will flush when number of events exceed upload threshold
1413
+ // Default value is 30
1414
+ flushQueueSize: 50,
1415
+ // Events queue will flush every certain milliseconds based on setting
1416
+ // Default value is 10000 milliseconds
1417
+ flushIntervalMillis: 20000,
1418
+ });
1419
+ </code></pre>
1420
+ <h3 id="eu-data-residency">EU data residency<a href="#eu-data-residency" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1421
+ <p>You can configure the server zone when initializing the client for sending data to Amplitude's EU servers. The SDK sends data based on the server zone if it's set.</p>
1422
+ <p>
1423
+ <div class="hint note"><h2 class="hint-title">Note</h2><div class="hint-content">
1424
+ For EU data residency, the project must be set up inside Amplitude EU. You must initialize the SDK with the API key from Amplitude EU.</div></div>
1425
+ </p>
1426
+ <pre><code class="language-ts">amplitude.init(API_KEY, OPTIONAL_USER_ID, {
1427
+ serverZone: 'EU',
1428
+ });
1429
+ </code></pre>
1430
+ <h3 id="debugging">Debugging<a href="#debugging" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1431
+ <p>You can control the level of logs printed to the developer console.</p>
1432
+ <ul>
1433
+ <li>'None': Suppresses all log messages.</li>
1434
+ <li>'Error': Shows error messages only.</li>
1435
+ <li>'Warn': Shows error messages and warnings. This is the default value if <code>logLevel</code> isn't explicitly specified.</li>
1436
+ <li>'Verbose': Shows informative messages.</li>
1437
+ <li>'Debug': Shows error messages, warnings, and informative messages that may be useful for debugging, including the function context information for all SDK public method invocations. This logging mode is only suggested to be used in development phases.</li>
1438
+ </ul>
1439
+ <p>Set the log level by configuring the <code>logLevel</code> with the level you want.</p>
1440
+ <pre><code class="language-ts">amplitude.init(AMPLITUDE_API_KEY, OPTIONAL_USER_ID, {
1441
+ logLevel: amplitude.Types.LogLevel.Warn,
1442
+ });
1443
+ </code></pre>
1444
+ <p>The default logger outputs log to the developer console. You can provide your own logger implementation based on the <code>Logger</code> interface for any customization purpose. For example, collecting any error messages from the SDK in a production environment.</p>
1445
+ <p>Set the logger by configuring the <code>loggerProvider</code> with your own implementation.</p>
1446
+ <pre><code class="language-ts">amplitude.init(AMPLITUDE_API_KEY, OPTIONAL_USER_ID, {
1447
+ loggerProvider: new MyLogger(),
1448
+ });
1449
+ </code></pre>
1450
+ <h4 id="debug-mode">Debug mode<a href="#debug-mode" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1451
+ <p>Enable the debug mode by setting the <code>logLevel</code> to &quot;Debug&quot;, for example:</p>
1452
+ <pre><code class="language-ts">amplitude.init(AMPLITUDE_API_KEY, OPTIONAL_USER_ID, {
1453
+ logLevel: amplitude.Types.LogLevel.Debug,
1454
+ });
1455
+ </code></pre>
1456
+ <p>The default logger outputs extra function context information to the developer console when invoking any SDK public method, including:</p>
1457
+ <ul>
1458
+ <li>'type': Category of this context, for example &quot;invoke public method&quot;.</li>
1459
+ <li>'name': Name of invoked function, for example &quot;track&quot;.</li>
1460
+ <li>'args': Arguments of the invoked function.</li>
1461
+ <li>'stacktrace': Stacktrace of the invoked function.</li>
1462
+ <li>'time': Start and end timestamp of the function invocation.</li>
1463
+ <li>'states': Useful internal states snapshot before and after the function invocation.</li>
1464
+ </ul>
1465
+ <h2 id="track-events">Track events<a href="#track-events" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1466
+ <p>
1467
+ <div class="hint note"><h2 class="hint-title">Note</h2><div class="hint-content">
1468
+ This SDK uses the <a href="/docs/apis/analytics/http-v2">HTTP V2</a> API and follows the same constraints for events. Make sure that all events logged in the SDK have the <code>event_type</code> field and at least one of <code>deviceId</code>  (included by default) or <code>userId</code>, and follow the HTTP API's constraints on each of those fields.</p>
1469
+ <p>To prevent instrumentation issues, device IDs and user IDs must be strings with a length of 5 characters or more. If an event contains a device ID or user ID that's too short, the ID value is removed from the event. If the event doesn't have a <code>userId</code> or <code>deviceId</code> value, the upload may be rejected with a 400 status. Override the default minimum length of 5 characters by setting the <code>minIdLength</code> config option.</div></div>
1470
+ </p>
1471
+ <p>Events represent how users interact with your application. For example, &quot;Button Clicked&quot; may be an action you want to note.</p>
1472
+ <pre><code class="language-ts">import { track } from '@amplitude/analytics-react-native';
1473
+
1474
+ // Track a basic event
1475
+ track('Button Clicked');
1476
+
1477
+ // Track events with optional properties
1478
+ const eventProperties = {
1479
+ buttonColor: 'primary',
1480
+ };
1481
+ track('Button Clicked', eventProperties);
1482
+ </code></pre>
1483
+ <h3 id="track-events-to-multiple-projects">Track events to multiple projects<a href="#track-events-to-multiple-projects" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1484
+ <p>If you need to log events to multiple Amplitude projects, you'll need to create separate instances for each Amplitude project. Then, pass the instance variables to wherever you want to call Amplitude. Each instance allows for independent <code>apiKeys</code>, <code>userIds</code>, <code>deviceIds</code>, and settings.</p>
1485
+ <pre><code class="language-ts">import * as amplitude from '@amplitude/analytics-react-native';
1486
+
1487
+ const defaultInstance = amplitude.createInstance();
1488
+ defaultInstance.init(API_KEY_DEFAULT);
1489
+
1490
+ const envInstance = amplitude.createInstance();
1491
+ envInstance.init(API_KEY_ENV, {
1492
+ instanceName: 'env',
1493
+ });
1494
+ </code></pre>
1495
+ <h2 id="user-properties">User properties<a href="#user-properties" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1496
+ <p>User properties help you understand your users at the time they performed some action within your app such as their device details, their preferences, or language.</p>
1497
+ <p>Identify is for setting the user properties of a particular user without sending any event. The SDK supports the operations <code>set</code>, <code>setOnce</code>, <code>unset</code>, <code>add</code>, <code>append</code>, <code>prepend</code>, <code>preInsert</code>, <code>postInsert</code>, <code>remove</code>, and <code>clearAll</code> on individual user properties. The operations are declared through a provided Identify interface. You can chain multiple operations together in a single Identify object. The Identify object is then passed to the Amplitude client to send to the server.</p>
1498
+ <p>
1499
+ <div class="hint note"><h2 class="hint-title">Note</h2><div class="hint-content">
1500
+ If the Identify call is sent after the event, the results of operations will be visible immediately in the dashboard user’s profile area, but it won't appear in chart result until another event is sent after the Identify call. The identify call only affects events going forward. More details <a href="/docs/data/user-properties-and-events">here</a>.</div></div>
1501
+ </p>
1502
+ <h3 id="identify">Identify<a href="#identify" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1503
+ <p>The Identify object provides controls over setting user properties. An Identify object must first be instantiated, then Identify methods can be called on it, and finally the client will make a call with the Identify object.</p>
1504
+ <pre><code class="language-ts">import { identify, Identify } from '@amplitude/analytics-react-native';
1505
+
1506
+ const identifyObj = new Identify();
1507
+ identify(identifyObj);
1508
+ </code></pre>
1509
+ <h4 id="identifyset">Identify.set<a href="#identifyset" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1510
+ <p>This method sets the value of a user property. For example, you can set a role property of a user.</p>
1511
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1512
+
1513
+ const identifyObj = new Identify();
1514
+ identifyObj.set('location', 'LAX');
1515
+
1516
+ identify(identifyObj);
1517
+ </code></pre>
1518
+ <h4 id="identifysetonce">Identify.setOnce<a href="#identifysetonce" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1519
+ <p>This method sets the value of a user property only once. Subsequent calls using setOnce() will be ignored. For example, you can set an initial login method for a user and since only the initial value is tracked, setOnce() ignores subsequent calls.</p>
1520
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1521
+
1522
+ const identifyObj = new Identify();
1523
+ identifyObj.setOnce('initial-location', 'SFO');
1524
+
1525
+ identify(identifyObj);
1526
+ </code></pre>
1527
+ <h4 id="identifyadd">Identify.add<a href="#identifyadd" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1528
+ <p>This method increments a user property by some numerical value. If the user property doesn't have a value set yet, it will be initialized to 0 before being incremented. For example, you can track a user's travel count.</p>
1529
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1530
+
1531
+ const identifyObj = new Identify();
1532
+ identifyObj.add('travel-count', 1);
1533
+
1534
+ identify(identifyObj);
1535
+ </code></pre>
1536
+ <h4 id="arrays-in-user-properties">Arrays in user properties<a href="#arrays-in-user-properties" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1537
+ <p>Arrays can be used as user properties. You can directly set arrays or use <code>prepend</code>, <code>append</code>, <code>preInsert</code> and <code>postInsert</code> to generate an array.</p>
1538
+ <h4 id="identifyprepend"><code>Identify.prepend</code><a href="#identifyprepend" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1539
+ <p>This method prepends a value or values to a user property array. If the user property doesn't have a value set yet, it will be initialized to an empty list before the new values are prepended.</p>
1540
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1541
+
1542
+ const identifyObj = new Identify();
1543
+ identifyObj.prepend('visited-locations', 'LAX');
1544
+
1545
+ identify(identifyObj);
1546
+ </code></pre>
1547
+ <h4 id="identifyappend"><code>Identify.append</code><a href="#identifyappend" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1548
+ <p>This method appends a value or values to a user property array. If the user property doesn't have a value set yet, it will be initialized to an empty list before the new values are prepended.</p>
1549
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1550
+
1551
+ const identifyObj = new Identify();
1552
+ identifyObj.append('visited-locations', 'SFO');
1553
+
1554
+ identify(identifyObj);
1555
+ </code></pre>
1556
+ <h4 id="identifypreinsert"><code>Identify.preInsert</code><a href="#identifypreinsert" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1557
+ <p>This method pre-inserts a value or values to a user property if it doesn't exist in the user property yet. Pre-insert means inserting the value at the beginning of a given list. If the user property doesn't have a value set yet, it will be initialized to an empty list before the new values are pre-inserted. If the user property has an existing value, it will be no operation.</p>
1558
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1559
+
1560
+ const identifyObj = new Identify();
1561
+ identifyObj.preInsert('unique-locations', 'LAX');
1562
+
1563
+ identify(identifyObj);
1564
+ </code></pre>
1565
+ <h4 id="identifypostinsert">Identify.postInsert<a href="#identifypostinsert" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1566
+ <p>This method post-inserts a value or values to a user property if it doesn't exist in the user property yet. Post-insert means inserting the value at the end of a given list. If the user property doesn't have a value set yet, it will be initialized to an empty list before the new values are post-inserted. If the user property has an existing value, it will be no operation.</p>
1567
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1568
+
1569
+ const identifyObj = new Identify();
1570
+ identifyObj.postInsert('unique-locations', 'SFO');
1571
+
1572
+ identify(identifyObj);
1573
+ </code></pre>
1574
+ <h4 id="identifyremove">Identify.remove<a href="#identifyremove" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1575
+ <p>This method removes a value or values to a user property if it exists in the user property. Remove means remove the existing values from the given list. If the item doesn't exist in the user property, it's a no-op.</p>
1576
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1577
+
1578
+ const identifyObj = new Identify();
1579
+ identifyObj.remove('unique-locations', 'JFK')
1580
+
1581
+ identify(identifyObj);
1582
+ </code></pre>
1583
+ <h4 id="identifyclearall">Identify.clearAll<a href="#identifyclearall" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1584
+ <p>This method removes all user properties from a user. Use <code>clearAll</code> with care because the operation is irreversible.</p>
1585
+ <pre><code class="language-ts">import { Identify, identify } from '@amplitude/analytics-react-native';
1586
+
1587
+ const identifyObj = new Identify();
1588
+ identifyObj.clearAll();
1589
+
1590
+ identify(identifyObj);
1591
+ </code></pre>
1592
+ <h3 id="user-groups">User groups<a href="#user-groups" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1593
+ <p>Amplitude supports assigning users to groups and performing queries, such as Count by Distinct, on those groups. If at least one member of the group has performed the specific event, then the count includes the group.</p>
1594
+ <p>For example, you want to group your users based on what organization they're in by using an 'orgId'. Joe is in 'orgId' '10', and Sue is in 'orgId' '15'. Sue and Joe both perform a certain event. You can query their organizations in the Event Segmentation Chart.</p>
1595
+ <p>When setting groups, define a <code>groupType</code> and <code>groupName</code>. In the previous example, 'orgId' is the <code>groupType</code> and '10' and '15' are the values for <code>groupName</code>. Another example of a <code>groupType</code> could be 'sport' with <code>groupName</code> values like 'tennis' and 'baseball'.</p>
1596
+ <p>Setting a group also sets the <code>groupType:groupName</code> as a user property, and overwrites any existing <code>groupName</code> value set for that user's groupType, and the corresponding user property value. <code>groupType</code> is a string, and <code>groupName</code> can be either a string or an array of strings to indicate that a user is in multiple groups.</p>
1597
+ <p>
1598
+ <div class="hint example"><h2 class="hint-title">Example</h2><div class="hint-content">
1599
+ If Joe is in 'orgId' '15', then the <code>groupName</code> would be '15'.</p>
1600
+ <pre><code class="language-ts">import { setGroup } from '@amplitude/analytics-react-native';
1601
+
1602
+ // set group with single group name
1603
+ setGroup('orgId', '15');
1604
+ </code></pre>
1605
+ <p>If Joe is in 'sport' 'tennis' and 'soccer', then the <code>groupName</code> would be '[&quot;tennis&quot;, &quot;soccer&quot;]'.</p>
1606
+ <pre><code class="language-ts">import { setGroup } from '@amplitude/analytics-react-native';
1607
+
1608
+ // set group with multiple group names
1609
+ setGroup('sport', ['soccer', 'tennis']);
1610
+ </code></pre>
1611
+ <p></div></div>
1612
+ </p>
1613
+ <p>You can also set <strong>event-level groups</strong> by passing an <code>Event</code> Object with <code>groups</code> to <code>track</code>. With event-level groups, the group designation applies only to the specific event being logged, and doesn't persist on the user unless you explicitly set it with <code>setGroup</code>.</p>
1614
+ <pre><code class="language-ts">import { track } from '@amplitude/analytics-react-native';
1615
+
1616
+ track({
1617
+ event_type: 'event type',
1618
+ event_properties: { eventPropertyKey: 'event property value' },
1619
+ groups: { 'orgId': '15' }
1620
+ });
1621
+ </code></pre>
1622
+ <h2 id="group-properties">Group properties<a href="#group-properties" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1623
+ <p>Use the Group Identify API to set or update the properties of particular groups. These updates only affect events going forward.</p>
1624
+ <p>The <code>groupIdentify()</code> method accepts a group type and group name string parameter, as well as an Identify object that will be applied to the group.</p>
1625
+ <pre><code class="language-ts">import { Identify, groupIdentify } from '@amplitude/analytics-react-native';
1626
+
1627
+ const groupType = 'plan';
1628
+ const groupName = 'enterprise';
1629
+ const event = new Identify()
1630
+ event.set('key1', 'value1');
1631
+
1632
+ groupIdentify(groupType, groupName, identify);
1633
+ </code></pre>
1634
+ <h2 id="track-revenue">Track revenue<a href="#track-revenue" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1635
+ <p>The preferred method of tracking revenue for a user is to use <code>revenue()</code> in conjunction with the provided Revenue interface. Revenue instances will store each revenue transaction and allow you to define several special revenue properties (such as &quot;revenueType&quot;, &quot;productIdentifier&quot;, etc.) that are used in Amplitude's Event Segmentation and Revenue LTV charts. These Revenue instance objects are then passed into <code>revenue()</code> to send as revenue events to Amplitude. This lets automatically display data relevant to revenue in the platform. You can use this to track both in-app and non-in-app purchases.</p>
1636
+ <p>To track revenue from a user, call revenue each time a user generates revenue. For example, 3 units of a product were purchased at $3.99.</p>
1637
+ <pre><code class="language-ts">import { Revenue, revenue } from '@amplitude/analytics-react-native';
1638
+
1639
+ const event = new Revenue()
1640
+ .setProductId('com.company.productId')
1641
+ .setPrice(3.99)
1642
+ .setQuantity(3);
1643
+
1644
+ revenue(event);
1645
+ </code></pre>
1646
+ <h3 id="revenue-interface">Revenue interface<a href="#revenue-interface" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1647
+ <table>
1648
+ <thead>
1649
+ <tr>
1650
+ <th>Name</th>
1651
+ <th>Description</th>
1652
+ </tr>
1653
+ </thead>
1654
+ <tbody>
1655
+ <tr>
1656
+ <td><code>product_id</code></td>
1657
+ <td>Optional. String. An identifier for the product. Amplitude recommends something like the Google Play Store product ID. Defaults to null.</td>
1658
+ </tr>
1659
+ <tr>
1660
+ <td><code>quantity</code></td>
1661
+ <td>Required. Int. The quantity of products purchased. <code>revenue = quantity * price</code>. Defaults to 1</td>
1662
+ </tr>
1663
+ <tr>
1664
+ <td><code>price</code></td>
1665
+ <td>Required. Double. The price of the products purchased, and this can be negative. <code>revenue = quantity * price</code>. Defaults to null.</td>
1666
+ </tr>
1667
+ <tr>
1668
+ <td><code>revenue_type</code></td>
1669
+ <td>Optional, but required for revenue verification. String. The revenue type (for example tax, refund, income). Defaults to null.</td>
1670
+ </tr>
1671
+ <tr>
1672
+ <td><code>receipt</code></td>
1673
+ <td>Optional. String. The receipt identifier of the revenue. Defaults to null</td>
1674
+ </tr>
1675
+ <tr>
1676
+ <td><code>receipt_sig</code></td>
1677
+ <td>Optional, but required for revenue verification. String. The receipt signature of the revenue. Defaults to null.</td>
1678
+ </tr>
1679
+ <tr>
1680
+ <td><code>properties</code></td>
1681
+ <td>Optional. JSONObject. An object of event properties to include in the revenue event. Defaults to null.</td>
1682
+ </tr>
1683
+ </tbody>
1684
+ </table>
1685
+ <h2 id="flush-the-event-buffer">Flush the event buffer<a href="#flush-the-event-buffer" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1686
+ <p>The <code>flush</code> method triggers the client to send buffered events.</p>
1687
+ <pre><code class="language-typescript">import { flush } from '@amplitude/analytics-react-native';
1688
+
1689
+ flush();
1690
+ </code></pre>
1691
+ <p>By default, <code>flush</code> is called automatically in an interval, if you want to flush the events altogether, you can control the async flow with the optional Promise interface, for example:</p>
1692
+ <pre><code class="language-typescript">await init(AMPLITUDE_API_KEY).promise;
1693
+ track('Button Clicked');
1694
+ await flush().promise;
1695
+ </code></pre>
1696
+ <h2 id="custom-user-id">Custom user ID<a href="#custom-user-id" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1697
+ <p>If your app has its login system that you want to track users with, you can call <code>setUserId</code> at any time.</p>
1698
+ <p>TypeScript</p>
1699
+ <pre><code class="language-ts">import { setUserId } from '@amplitude/analytics-react-native';
1700
+
1701
+ setUserId('user@amplitude.com');
1702
+ </code></pre>
1703
+ <p>You can also assign the User ID as an argument to the init call.</p>
1704
+ <pre><code class="language-ts">import { init } from '@amplitude/analytics-react-native';
1705
+
1706
+ init(API_KEY, 'user@amplitude.com');
1707
+ </code></pre>
1708
+ <h2 id="custom-session-id">Custom session ID<a href="#custom-session-id" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1709
+ <p>You can assign a new Session ID using <code>setSessionId</code>. When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).</p>
1710
+ <p>TypeScript</p>
1711
+ <pre><code class="language-ts">import { setSessionId } from '@amplitude/analytics-react-native';
1712
+
1713
+ setSessionId(Date.now());
1714
+ </code></pre>
1715
+ <h2 id="custom-device-id">Custom device ID<a href="#custom-device-id" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1716
+ <p>If your app has its login system that you want to track users with, you can call <code>setUserId</code> at any time.</p>
1717
+ <p>You can assign a new device ID using <code>deviceId</code>. When setting a custom device ID, make sure the value is sufficiently unique. A UUID is recommended.</p>
1718
+ <pre><code class="language-ts">import { setDeviceId } from '@amplitude/analytics-react-native';
1719
+ const { uuid } = require('uuidv4');
1720
+
1721
+ setDeviceId(uuid());
1722
+ </code></pre>
1723
+ <h2 id="reset-when-a-user-logs-out">Reset when a user logs out<a href="#reset-when-a-user-logs-out" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1724
+ <p><code>reset</code> is a shortcut to anonymize users after they log out, by:</p>
1725
+ <ul>
1726
+ <li>setting <code>userId</code> to <code>undefined</code></li>
1727
+ <li>setting <code>deviceId</code> to a new UUID value</li>
1728
+ </ul>
1729
+ <p>With an undefined <code>userId</code> and a completely new <code>deviceId</code>, the current user would appear as a brand new user in dashboard.</p>
1730
+ <pre><code class="language-ts">import { reset } from '@amplitude/analytics-react-native';
1731
+
1732
+ reset();
1733
+ </code></pre>
1734
+ <h2 id="opt-users-out-of-tracking">Opt users out of tracking<a href="#opt-users-out-of-tracking" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1735
+ <p>You can turn off logging for a given user by setting <code>setOptOut</code> to <code>true</code>.</p>
1736
+ <pre><code class="language-ts">import { setOptOut } from '@amplitude/analytics-react-native';
1737
+
1738
+ setOptOut(true);
1739
+ </code></pre>
1740
+ <p>No events are saved or sent to the server while <code>setOptOut</code> is enabled, and the setting persists across page loads.</p>
1741
+ <p>Re-enable logging by setting <code>setOptOut</code> to <code>false</code>.</p>
1742
+ <pre><code class="language-ts">import { setOptOut } from '@amplitude/analytics-react-native';
1743
+
1744
+ setOptOut(false);
1745
+ </code></pre>
1746
+ <h2 id="optional-tracking">Optional tracking<a href="#optional-tracking" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1747
+ <p>By default, the SDK tracks these properties automatically. You can override this behavior by passing a configuration called <code>trackingOptions</code> when initializing the SDK, setting the appropriate options to false.</p>
1748
+ <table>
1749
+ <thead>
1750
+ <tr>
1751
+ <th>Tracking Options</th>
1752
+ <th>Default</th>
1753
+ </tr>
1754
+ </thead>
1755
+ <tbody>
1756
+ <tr>
1757
+ <td><code>adid</code></td>
1758
+ <td><code>true</code></td>
1759
+ </tr>
1760
+ <tr>
1761
+ <td><code>carrier</code></td>
1762
+ <td><code>true</code></td>
1763
+ </tr>
1764
+ <tr>
1765
+ <td><code>deviceManufacturer</code></td>
1766
+ <td><code>true</code></td>
1767
+ </tr>
1768
+ <tr>
1769
+ <td><code>deviceModel</code></td>
1770
+ <td><code>true</code></td>
1771
+ </tr>
1772
+ <tr>
1773
+ <td><code>ipAddress</code></td>
1774
+ <td><code>true</code></td>
1775
+ </tr>
1776
+ <tr>
1777
+ <td><code>language</code></td>
1778
+ <td><code>true</code></td>
1779
+ </tr>
1780
+ <tr>
1781
+ <td><code>osName</code></td>
1782
+ <td><code>true</code></td>
1783
+ </tr>
1784
+ <tr>
1785
+ <td><code>osVersion</code></td>
1786
+ <td><code>true</code></td>
1787
+ </tr>
1788
+ <tr>
1789
+ <td><code>platform</code></td>
1790
+ <td><code>true</code></td>
1791
+ </tr>
1792
+ </tbody>
1793
+ </table>
1794
+ <pre><code class="language-ts">amplitude.init(API_KEY, OPTIONAL_USER_ID, {
1795
+ trackingOptions: {
1796
+ adid: false,
1797
+ appSetId: false,
1798
+ carrier: false,
1799
+ deviceManufacturer: false,
1800
+ deviceModel: false,
1801
+ ipAddress: false,
1802
+ idfv: false,
1803
+ language: false,
1804
+ osName: false,
1805
+ osVersion: false,
1806
+ platform: false,
1807
+ },
1808
+ });
1809
+ </code></pre>
1810
+ <h2 id="callback">Callback<a href="#callback" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1811
+ <p>All asynchronous APIs are optionally awaitable through a Promise interface. This also serves as a callback interface.</p>
1812
+ <pre><code class="language-ts">import { track } from '@amplitude/analytics-react-native';
1813
+
1814
+ // Using async/await
1815
+ const results = await track('Button Clicked').promise;
1816
+ result.event; // {...} (The final event object sent to Amplitude)
1817
+ result.code; // 200 (The HTTP response status code of the request.
1818
+ result.message; // &quot;Event tracked successfully&quot; (The response message)
1819
+
1820
+ // Using promises
1821
+ track('Button Clicked').promise.then((result) =&gt; {
1822
+ result.event; // {...} (The final event object sent to Amplitude)
1823
+ result.code; // 200 (The HTTP response status code of the request.
1824
+ result.message; // &quot;Event tracked successfully&quot; (The response message)
1825
+ });
1826
+ </code></pre>
1827
+ <h2 id="plugins">Plugins<a href="#plugins" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1828
+ <p>Plugins allow you to extend Amplitude SDK's behavior by, for example, modifying event properties (enrichment type) or sending to third-party APIs (destination type). A plugin is an object with methods <code>setup()</code> and <code>execute()</code>.</p>
1829
+ <p>For Session Replay integration with Segment, review the <a href="/docs/session-replay/session-replay-react-native-segment-integration">Session Replay React Native Segment Integration</a> guide.</p>
1830
+ <h3 id="add">add<a href="#add" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1831
+ <p>The <code>add</code> method adds a plugin to Amplitude. Plugins can help processing and sending events.</p>
1832
+ <pre><code class="language-typescript">import { add } from '@amplitude/analytics-react-native';
1833
+
1834
+ add(new Plugin());
1835
+ </code></pre>
1836
+ <h3 id="remove">remove<a href="#remove" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1837
+ <p>The <code>remove</code> method removes the given plugin name from the client instance if it exists.</p>
1838
+ <pre><code class="language-typescript">import { remove } from '@amplitude/analytics-react-native';
1839
+
1840
+ remove(plugin.name);
1841
+ </code></pre>
1842
+ <h3 id="plugin-setup">Plugin setup<a href="#plugin-setup" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1843
+ <p>This method contains logic for preparing the plugin for use and has config as a parameter. The expected return value is undefined. A typical use for this method, is to copy configuration from config or instantiate plugin dependencies. This method is called when the plugin is registered to the client via <code>client.add()</code>.</p>
1844
+ <h3 id="pluginexecute">Plugin.execute<a href="#pluginexecute" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1845
+ <p>This method contains the logic for processing events and has event as parameter. If used as enrichment type plugin, the expected return value is the modified/enriched event; while if used as a destination type plugin, the expected return value is a map with keys: <code>event</code> (BaseEvent), <code>code</code> (number), and <code>message</code> (string). This method is called for each event, including Identify, GroupIdentify and Revenue events, that's instrumented using the client interface.</p>
1846
+ <h3 id="enrichment-type-plugin-example">Enrichment type plugin example<a href="#enrichment-type-plugin-example" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1847
+ <p>Here's an example of a plugin that modifies each event that's instrumented by adding an increment integer to <code>event_id</code> property of an event starting from 100.</p>
1848
+ <pre><code class="language-ts">import { init, add } from '@amplitude/analytics-react-native';
1849
+ import { ReactNativeConfig, EnrichmentPlugin, Event, PluginType } from '@amplitude/analytics-types';
1850
+
1851
+ export class AddEventIdPlugin implements EnrichmentPlugin {
1852
+ name = 'add-event-id';
1853
+ type = PluginType.ENRICHMENT as const;
1854
+ currentId = 100;
1855
+ config?: ReactNativeConfig;
1856
+
1857
+ /**
1858
+ * setup() is called on plugin installation
1859
+ * example: client.add(new AddEventIdPlugin());
1860
+ */
1861
+ async setup(config: ReactNativeConfig): Promise&lt;undefined&gt; {
1862
+ this.config = config;
1863
+ return;
1864
+ }
1865
+
1866
+ /**
1867
+ * execute() is called on each event instrumented
1868
+ * example: client.track('New Event');
1869
+ */
1870
+ async execute(event: Event): Promise&lt;Event&gt; {
1871
+ event.event_id = this.currentId++;
1872
+ return event;
1873
+ }
1874
+ }
1875
+
1876
+ init('API_KEY');
1877
+ add(new AddEventIdPlugin());
1878
+ </code></pre>
1879
+ <h3 id="destination-type-plugin-example">Destination type plugin example<a href="#destination-type-plugin-example" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1880
+ <p>Here's an example of a plugin that sends each instrumented event to a target server URL using your preferred HTTP client.</p>
1881
+ <pre><code class="language-ts">import { init, add } from '@amplitude/analytics-react-native';
1882
+ import { ReactNativeConfig, DestinationPlugin, Event, PluginType, Result } from '@amplitude/analytics-types';
1883
+
1884
+ export class MyDestinationPlugin implements DestinationPlugin {
1885
+ name = 'my-destination-plugin';
1886
+ type = PluginType.DESTINATION as const;
1887
+ serverUrl: string;
1888
+ config?: ReactNativeConfig;
1889
+
1890
+ constructor(serverUrl: string) {
1891
+ this.serverUrl = serverUrl;
1892
+ }
1893
+
1894
+ /**
1895
+ * setup() is called on plugin installation
1896
+ * example: client.add(new MyDestinationPlugin());
1897
+ */
1898
+ async setup(config: ReactNativeConfig): Promise&lt;undefined&gt; {
1899
+ this.config = config;
1900
+ return;
1901
+ }
1902
+
1903
+ /**
1904
+ * execute() is called on each event instrumented
1905
+ * example: client.track('New Event');
1906
+ */
1907
+ async execute(event: Event): Promise&lt;Result&gt; {
1908
+ const payload = { key: 'secret', data: event };
1909
+ const response = await fetch(this.serverUrl, {
1910
+ method: 'POST',
1911
+ headers: {
1912
+ 'Content-Type': 'application/json',
1913
+ Accept: '*/*',
1914
+ },
1915
+ body: JSON.stringify(payload),
1916
+ });
1917
+ return {
1918
+ code: response.status,
1919
+ event: event,
1920
+ message: response.statusText,
1921
+ };
1922
+ }
1923
+ }
1924
+
1925
+ init('API_KEY');
1926
+ add(new MyDestinationPlugin('https://custom.domain.com'));
1927
+ </code></pre>
1928
+ <h2 id="advanced-topics">Advanced topics<a href="#advanced-topics" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h2>
1929
+ <h3 id="custom-http-client">Custom HTTP client<a href="#custom-http-client" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1930
+ <p>You can provide an implementation of <code>Transport</code> interface to the <code>transportProvider</code> configuration option for customization purpose, for example, sending requests to your proxy server with customized HTTP request headers.</p>
1931
+ <pre><code class="language-ts">import { Transport } from '@amplitude/analytics-types';
1932
+
1933
+ class MyTransport implements Transport {
1934
+ async send(serverUrl: string, payload: Payload): Promise&lt;Response | null&gt; {
1935
+ // check example: https://github.com/amplitude/Amplitude-TypeScript/blob/main/packages/analytics-client-common/src/transports/fetch.ts
1936
+ }
1937
+ }
1938
+
1939
+ amplitude.init(API_KEY, OPTIONAL_USER_ID, {
1940
+ transportProvider: new MyTransport(),
1941
+ });
1942
+ </code></pre>
1943
+ <h3 id="location">Location<a href="#location" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1944
+ <p>The Amplitude ingestion servers resolve event location in the following order:</p>
1945
+ <ol>
1946
+ <li>User-provided <code>city</code>, <code>country</code>, <code>region</code></li>
1947
+ <li>Resolved from <code>location_lat</code> and <code>location_lng</code></li>
1948
+ <li>Resolved from <code>ip</code></li>
1949
+ </ol>
1950
+ <p>By default, location will be determined by the <code>ip</code> on the server side. If you want more provide more granular location you can set <code>city</code>, <code>country</code> and <code>region</code> individually, or set <code>location_lat</code> and <code>location_lng</code> which will then be resolved to <code>city</code>, <code>country</code> and <code>region</code> on the server.<br />
1951
+ Amplitude doesn't set precise location in the SDK to avoid extra permissions that my not be needed by all customers.</p>
1952
+ <p>To set fine grain location, you can use an enrichment Plugin. Here is an <a href="https://github.com/amplitude/Amplitude-TypeScript/blob/v1.x/examples/plugins/react-native-get-location-plugin/LocationPlugin.ts">example</a> of how to set <code>location_lat</code> and <code>location_lng</code>.</p>
1953
+ <p>Disabling IP tracking with <code>ipAddress: false</code> in <a href="#optional-tracking">TrackingOptions</a> prevents location from being resolved on the backend. In this case you may want to create a Plugin like above to set any relevant location information yourself.</p>
1954
+ <h3 id="carrier">Carrier<a href="#carrier" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1955
+ <p>Carrier support works on Android, but Apple stopped supporting it in iOS 16. In earlier versions of iOS, we fetch carrier info using <code>CTCarrier</code> and <code>serviceSubscriberCellularProviders</code> which are <a href="https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/3024511-servicesubscribercellularprovide">deprecated</a> with <a href="https://developer.apple.com/forums/thread/714876?answerId=728276022#728276022">no replacement</a>.</p>
1956
+ <h3 id="advertising-identifiers">Advertising Identifiers<a href="#advertising-identifiers" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
1957
+ <p>Different platforms have different advertising identifiers. Due to user privacy concerns, Amplitude does not automatically collect these identifiers. However, it is easy to enable them using the instructions below. It is important to note that some identifiers are no longer recommended for use by the platform providers. Read the notes below before deciding to enable them.</p>
1958
+ <table>
1959
+ <thead>
1960
+ <tr>
1961
+ <th>Platform</th>
1962
+ <th>Advertising Identifier</th>
1963
+ <th>Recommended</th>
1964
+ <th>Notes</th>
1965
+ </tr>
1966
+ </thead>
1967
+ <tbody>
1968
+ <tr>
1969
+ <td>Android</td>
1970
+ <td>AppSetId</td>
1971
+ <td>Yes</td>
1972
+ <td><a href="https://developer.android.com/training/articles/app-set-id">AppSetId</a> is a unique identifier for the app instance. It is reset when the app is reinstalled.</td>
1973
+ </tr>
1974
+ <tr>
1975
+ <td>Android</td>
1976
+ <td>ADID</td>
1977
+ <td>No</td>
1978
+ <td><a href="https://support.google.com/googleplay/android-developer/answer/6048248?hl=en">ADID</a> is a unique identifier for the device. It is reset when the user opts out of personalized ads.</td>
1979
+ </tr>
1980
+ <tr>
1981
+ <td>iOS</td>
1982
+ <td>IDFV</td>
1983
+ <td>Yes</td>
1984
+ <td><a href="https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor">IDFV</a> is a unique identifier for the app instance. It is reset when the app is reinstalled.</td>
1985
+ </tr>
1986
+ <tr>
1987
+ <td>iOS</td>
1988
+ <td>IDFA</td>
1989
+ <td>No</td>
1990
+ <td><a href="https://developer.apple.com/documentation/adsupport/asidentifiermanager/1614151-advertisingidentifier">IDFA</a> is a unique identifier for the device. It is reset when the user opts out of personalized ads.</td>
1991
+ </tr>
1992
+ </tbody>
1993
+ </table>
1994
+ <h4 id="android">Android<a href="#android" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
1995
+ <h5 id="app-set-id">App set ID<a href="#app-set-id" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h5>
1996
+ <p>App set ID is a unique identifier for each app install on a device. App set ID is reset by the user manually when they uninstall the app, or after 13 months of not opening the app. Google designed this as a privacy-friendly alternative to Ad ID for users who want to opt out of stronger analytics.</p>
1997
+ <p>To use App Set ID, follow these steps.</p>
1998
+ <ol>
1999
+ <li>
2000
+ <p>Add <code>play-services-appset</code> as a dependency to the Android project of your app.</p>
2001
+ <pre><code class="language-bash">dependencies {
2002
+ implementation 'com.google.android.gms:play-services-appset:16.0.2'
2003
+ }
2004
+ </code></pre>
2005
+ </li>
2006
+ <li>
2007
+ <p>Enable <code>trackingOptions.appSetId</code></p>
2008
+ <pre><code class="language-ts">amplitude.init(API_KEY, OPTIONAL_USER_ID, {
2009
+ trackingOptions: {
2010
+ appSetId: true,
2011
+ },
2012
+ });
2013
+ </code></pre>
2014
+ </li>
2015
+ </ol>
2016
+ <h5 id="android-ad-id">Android Ad ID<a href="#android-ad-id" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h5>
2017
+ <p>Android Ad ID is a unique identifier for each device. Android Ad ID is reset by the user manually when they opt out of personalized ads.</p>
2018
+ <p>To use Android Ad ID, follow these steps.</p>
2019
+ <ol>
2020
+ <li>
2021
+ <p>Add <code>play-services-ads-identifier</code> as a dependency to the Android project of your app. More detailed setup is <a href="/docs/sdks/analytics/android/android-kotlin-sdk#advertiser-id">described in our latest Android SDK docs</a>.</p>
2022
+ <pre><code class="language-bash">dependencies {
2023
+ implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
2024
+ }
2025
+ </code></pre>
2026
+ </li>
2027
+ </ol>
2028
+ <p>Android Ad Id is enabled by default. To disable it, set <code>trackingOptions.adId</code> to <code>false</code>.</p>
2029
+ <pre><code class="language-ts">amplitude.init(API_KEY, OPTIONAL_USER_ID, {
2030
+ trackingOptions: {
2031
+ adId: false,
2032
+ },
2033
+ });
2034
+ </code></pre>
2035
+ <h4 id="ios">iOS<a href="#ios" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h4>
2036
+ <h5 id="idfv">IDFV<a href="#idfv" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h5>
2037
+ <p>IDFV is a unique identifier for the app instance. It is reset when the app is reinstalled.</p>
2038
+ <p>To enable IDFV on iOS devices set <code>trackingOptions.idfv</code> to <code>true</code>.</p>
2039
+ <pre><code class="language-ts">amplitude.init(API_KEY, OPTIONAL_USER_ID, {
2040
+ trackingOptions: {
2041
+ idfv: true,
2042
+ },
2043
+ });
2044
+ </code></pre>
2045
+ <h5 id="idfa">IDFA<a href="#idfa" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h5>
2046
+ <p>
2047
+ <div class="hint warning"><h2 class="hint-title">Warning</h2><div class="hint-content">
2048
+ IDFA is no longer recommended. You should consider using IDFV instead when possible.</div></div>
2049
+ </p>
2050
+ <p>IDFA is a unique identifier for the device. It is reset when the user opts out of personalized ads.</p>
2051
+ <p>The React Native SDK does not directly access the IDFA as it would require adding the <code>AdSupport.framework</code> to your app. Instead you can use an Enrichment Plugin to set the IDFA yourself.</p>
2052
+ <p>Here is an <a href="https://github.com/amplitude/Amplitude-TypeScript/blob/main/examples/plugins/react-native-idfa-plugin/idfaPlugin.ts">example Plugin that sets the IDFA</a> using a third-party library.</p>
2053
+ <h3 id="over-the-air-updates-ota">Over the air updates (OTA)<a href="#over-the-air-updates-ota" class="heading-permalink" aria-hidden="true" title="Permalink"></a></h3>
2054
+ <p>If you are using platform like Expo that supports OTA updates. It is important to know our SDK has both native and JS code. If you are using OTA updates, you will need to make sure the native code is updated as well. See Expo's documentation on <a href="https://docs.expo.dev/archive/classic-updates/publishing">publishing</a> and <a href="https://docs.expo.dev/eas-update/runtime-versions/">runtime versions</a> for more details.</p>
2055
+ <p>Below are versions of the SDK with the native code changes:</p>
2056
+ <table>
2057
+ <thead>
2058
+ <tr>
2059
+ <th>@amplitude/analytics-react-native</th>
2060
+ </tr>
2061
+ </thead>
2062
+ <tbody>
2063
+ <tr>
2064
+ <td><a href="https://github.com/amplitude/Amplitude-TypeScript/releases/tag/%40amplitude%2Fanalytics-react-native%401.3.0">1.3.0</a></td>
2065
+ </tr>
2066
+ </tbody>
2067
+ </table>
2068
+
2069
+
2070
+ </div>
2071
+ </div>
2072
+
2073
+
2074
+
2075
+
2076
+ <div class="relative basis-64 shrink-0 hidden lg:block">
2077
+ <div class="flex flex-row ml-8 mb-2">
2078
+
2079
+
2080
+ <div class="copy-page-menu relative" data-md-url="/docs/md/sdks/analytics/react-native/react-native-sdk.md">
2081
+ <button class="copy-page-toggle group flex items-center font-medium border border-white hover:border-amp-gray-200 rounded-md transition-all duration-200"
2082
+ aria-label="Copy page options" title="Copy page options">
2083
+ <div class="flex items-center justify-center">
2084
+ <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="currentColor" class="w-6 h-6 text-amp-gray-500 transition-transform duration-200 group-hover:-translate-y-px"> <path d="M362.31-260Q332-260 311-281q-21-21-21-51.31v-455.38Q290-818 311-839q21-21 51.31-21h335.38Q728-860 749-839q21 21 21 51.31v455.38Q770-302 749-281q-21 21-51.31 21H362.31Zm0-60h335.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-455.38q0-4.62-3.85-8.46-3.84-3.85-8.46-3.85H362.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v455.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85Zm-140 200Q192-120 171-141q-21-21-21-51.31v-515.38h60v515.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85h395.38v60H222.31ZM350-320v-480 480Z" />
2085
+ </svg>
2086
+ </div>
2087
+ </button>
2088
+
2089
+ <!-- Dropdown Menu -->
2090
+ <div class="copy-page-dropdown hidden absolute right-0 mt-2 w-56 bg-white rounded-md shadow-lg border border-amp-gray-200 z-50 opacity-0 scale-95 transition-all duration-100 ease-out">
2091
+ <div class="py-1">
2092
+ <button class="copy-markdown-btn flex items-center w-full px-4 py-2 text-sm text-amp-gray-700 hover:bg-amp-gray-50 hover:text-amp-gray-900 transition-colors duration-150">
2093
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
2094
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
2095
+ </svg>
2096
+ Copy as Markdown
2097
+ </button>
2098
+
2099
+ <a href="/docs/md/sdks/analytics/react-native/react-native-sdk.md" target="_blank" class="copy-page-link flex items-center w-full px-4 py-2 text-sm text-amp-gray-700 hover:bg-amp-gray-50 hover:text-amp-gray-900 transition-colors duration-150">
2100
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
2101
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
2102
+ </svg>
2103
+ View as Markdown
2104
+ </a>
2105
+
2106
+ <hr class="my-1 border-amp-gray-100">
2107
+
2108
+ <a href="https://chat.openai.com/?q=Look+at+this+document+from+Amplitude+so+I+can+ask+questions+about+it%3A+https%3A//amplitude.com/docs/md/sdks/analytics/react-native/react-native-sdk.md" target="_blank" class="open-chatgpt copy-page-link flex items-center w-full px-4 py-2 text-sm text-amp-gray-700 hover:bg-amp-gray-50 hover:text-amp-gray-900 transition-colors duration-150">
2109
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-3" viewBox="0 0 320 320">
2110
+ <path d="m297.06 130.97c7.26-21.79 4.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13 22.48-76.91 55.82-22.51 4.61-41.94 18.7-53.31 38.67-17.59 30.32-13.58 68.54 9.92 94.54-7.26 21.79-4.76 45.66 6.85 65.48 17.46 30.4 52.56 46.04 86.84 38.68 15.24 17.18 37.16 26.95 60.13 26.8 35.06.09 66.16-22.49 76.94-55.86 22.51-4.61 41.94-18.7 53.31-38.67 17.57-30.32 13.55-68.51-9.94-94.51zm-120.28 168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26 1.34-.73 1.89-1.07l63.72-36.8c3.26-1.85 5.26-5.32 5.24-9.07v-89.83l26.93 15.55c.29.14.48.42.52.74v74.39c-.04 33.08-26.83 59.9-59.91 59.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28 1.3.79 1.89 1.13l63.72 36.8c3.23 1.89 7.23 1.89 10.47 0l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41 37.19c-28.69 16.52-65.33 6.7-81.92-21.95zm-16.77-139.09c7-12.16 18.05-21.46 31.21-26.29 0 .55-.03 1.52-.03 2.2v73.61c-.02 3.74 1.98 7.21 5.23 9.06l77.79 44.91-26.93 15.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26 51.49-77.79-44.92 26.93-15.54c.27-.18.61-.21.91-.08l64.42 37.19c28.68 16.57 38.51 53.26 21.94 81.94-7.01 12.14-18.05 21.44-31.2 26.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47 0l-77.79 44.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55 65.37-6.7 81.91 22 6.99 12.12 9.52 26.31 7.15 40.1zm-168.51 55.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12 26.89-59.96 60.01-59.94 14.01 0 27.57 4.92 38.34 13.88-.49.26-1.33.73-1.89 1.07l-63.72 36.8c-3.26 1.85-5.26 5.31-5.24 9.06l-.04 89.79zm14.63-31.54 34.65-20.01 34.65 20v40.01l-34.65 20-34.65-20z"/>
2111
+ </svg>
2112
+ Open in ChatGPT
2113
+ </a>
2114
+
2115
+ <a href="https://claude.ai/chat?q=Look+at+this+document+from+Amplitude+so+I+can+ask+questions+about+it%3A+https%3A//amplitude.com/docs/md/sdks/analytics/react-native/react-native-sdk.md" target="_blank" class="open-claude copy-page-link flex items-center w-full px-4 py-2 text-sm text-amp-gray-700 hover:bg-amp-gray-50 hover:text-amp-gray-900 transition-colors duration-150">
2116
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="h-4 w-4 mr-3" viewBox="0 0 256 256" xml:space="preserve">
2117
+ <g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)">
2118
+ <path d="M 17.671 59.85 l 17.699 -9.93 l 0.298 -0.862 l -0.298 -0.48 h -0.862 l -2.958 -0.182 l -10.113 -0.273 l -8.77 -0.364 L 4.17 47.302 l -2.138 -0.456 l -2.004 -2.642 l 0.207 -1.318 l 1.798 -1.209 l 2.575 0.225 l 5.691 0.389 l 8.54 0.589 l 6.195 0.364 l 9.177 0.954 h 1.458 l 0.207 -0.589 l -0.498 -0.364 l -0.389 -0.364 l -8.837 -5.989 l -9.566 -6.329 l -5.011 -3.644 l -2.709 -1.846 l -1.367 -1.731 l -0.589 -3.778 l 2.46 -2.709 l 3.304 0.225 l 0.844 0.225 l 3.347 2.575 l 7.149 5.533 l 9.335 6.875 l 1.367 1.136 l 0.547 -0.389 l 0.067 -0.273 l -0.613 -1.026 l -5.078 -9.177 l -5.418 -9.335 l -2.411 -3.869 l -0.638 -2.32 C 20.945 6.08 20.781 5.278 20.781 4.3 l 2.8 -3.802 L 25.13 0 l 3.735 0.498 l 1.573 1.367 l 2.32 5.308 l 3.76 8.357 l 5.831 11.364 l 1.707 3.371 l 0.911 3.122 l 0.34 0.954 h 0.589 v -0.547 l 0.48 -6.402 l 0.887 -7.859 L 48.125 9.42 l 0.298 -2.849 l 1.409 -3.413 l 2.8 -1.846 l 2.187 1.045 l 1.798 2.575 l -0.249 1.664 l -1.069 6.948 l -2.095 10.884 l -1.367 7.288 h 0.796 l 0.911 -0.911 l 3.687 -4.895 l 6.195 -7.744 l 2.733 -3.073 l 3.189 -3.395 l 2.047 -1.616 h 3.869 l 2.849 4.233 l -1.275 4.373 l -3.984 5.053 l -3.304 4.282 l -4.737 6.377 l -2.958 5.102 l 0.273 0.407 l 0.705 -0.067 l 10.702 -2.278 l 5.782 -1.045 l 6.9 -1.184 l 3.122 1.458 l 0.34 1.482 l -1.227 3.031 l -7.38 1.822 l -8.655 1.731 l -12.888 3.049 l -0.158 0.115 l 0.182 0.225 l 5.806 0.547 l 2.484 0.134 h 6.08 l 11.321 0.844 l 2.958 1.956 l 1.774 2.393 l -0.298 1.822 l -4.555 2.32 l -6.147 -1.458 l -14.346 -3.413 l -4.92 -1.227 h -0.68 v 0.407 l 4.1 4.009 l 7.513 6.784 l 9.408 8.746 l 0.48 2.162 l -1.209 1.707 L 78.044 75.8 l -8.266 -6.219 l -3.189 -2.8 l -7.222 -6.08 h -0.48 v 0.638 l 1.664 2.436 l 8.789 13.21 l 0.456 4.051 l -0.638 1.318 l -2.278 0.796 l -2.502 -0.456 l -5.144 -7.222 l -5.308 -8.133 l -4.282 -7.288 l -0.522 0.298 l -2.527 27.216 l -1.184 1.391 L 42.677 90 l -2.278 -1.731 l -1.209 -2.8 l 1.209 -5.533 l 1.458 -7.222 l 1.184 -5.74 l 1.069 -7.131 l 0.638 -2.369 l -0.043 -0.158 l -0.522 0.067 l -5.375 7.38 l -8.175 11.048 l -6.468 6.924 l -1.549 0.613 l -2.685 -1.391 l 0.249 -2.484 l 1.5 -2.211 l 8.953 -11.388 l 5.4 -7.058 l 3.486 -4.075 l -0.024 -0.589 h -0.207 L 15.509 69.592 l -4.233 0.547 l -1.822 -1.707 l 0.225 -2.8 l 0.862 -0.911 l 7.149 -4.92 l -0.024 0.024 L 17.671 59.85 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
2119
+ </g>
2120
+ </svg>
2121
+ Open in Claude
2122
+ </a>
2123
+ </div>
2124
+ </div>
2125
+
2126
+ </div>
2127
+
2128
+ <style>
2129
+ /* Custom Tippy.js themes for success and error states */
2130
+ .tippy-box[data-theme~='light-success'] {
2131
+ background-color: #dcfce7;
2132
+ color: #166534;
2133
+ border: 1px solid #bbf7d0;
2134
+ }
2135
+
2136
+ .tippy-box[data-theme~='light-success'] .tippy-arrow {
2137
+ color: #dcfce7;
2138
+ }
2139
+
2140
+ .tippy-box[data-theme~='light-error'] {
2141
+ background-color: #fef2f2;
2142
+ color: #dc2626;
2143
+ border: 1px solid #fecaca;
2144
+ }
2145
+
2146
+ .tippy-box[data-theme~='light-error'] .tippy-arrow {
2147
+ color: #fef2f2;
2148
+ }
2149
+ </style>
2150
+
2151
+ <script>
2152
+ (function() {
2153
+ 'use strict';
2154
+
2155
+ // Initialize when DOM is ready
2156
+ if (document.readyState === 'loading') {
2157
+ document.addEventListener('DOMContentLoaded', initCopyPageMenu);
2158
+ } else {
2159
+ initCopyPageMenu();
2160
+ }
2161
+
2162
+ function initCopyPageMenu() {
2163
+ const menus = document.querySelectorAll('.copy-page-menu');
2164
+ menus.forEach(menu => {
2165
+ const toggle = menu.querySelector('.copy-page-toggle');
2166
+ const dropdown = menu.querySelector('.copy-page-dropdown');
2167
+ const arrow = menu.querySelector('.copy-page-arrow');
2168
+ const copyBtn = menu.querySelector('.copy-markdown-btn');
2169
+ const links = menu.querySelectorAll('.copy-page-link');
2170
+ const mdUrl = menu.dataset.mdUrl;
2171
+
2172
+ let isOpen = false;
2173
+ let copyTooltip = null;
2174
+
2175
+ // Initialize Tippy.js tooltip for copy button
2176
+ if (window.tippy && copyBtn) {
2177
+ copyTooltip = tippy(copyBtn, {
2178
+ content: 'Copy as Markdown',
2179
+ placement: 'top',
2180
+ trigger: 'manual',
2181
+ theme: 'light',
2182
+ animation: 'fade',
2183
+ duration: [200, 150],
2184
+ hideOnClick: false
2185
+ });
2186
+ }
2187
+
2188
+ // Toggle dropdown
2189
+ toggle.addEventListener('click', (e) => {
2190
+ e.stopPropagation();
2191
+ toggleDropdown();
2192
+ });
2193
+
2194
+ // Close on outside click
2195
+ document.addEventListener('click', (e) => {
2196
+ if (isOpen && !menu.contains(e.target)) {
2197
+ closeDropdown();
2198
+ }
2199
+ });
2200
+
2201
+ // Close dropdown when links are clicked
2202
+ links.forEach(link => {
2203
+ link.addEventListener('click', () => {
2204
+ closeDropdown();
2205
+ });
2206
+ });
2207
+
2208
+ // Copy markdown functionality
2209
+ copyBtn.addEventListener('click', async () => {
2210
+ try {
2211
+ const resp = await fetch(mdUrl);
2212
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
2213
+ const raw = await resp.text();
2214
+
2215
+ // Strip YAML front matter
2216
+ const md = raw.replace(/^---[\r\n]+[\s\S]*?[\r\n]+---[\r\n]*/, '');
2217
+
2218
+ if (navigator.clipboard?.writeText) {
2219
+ await navigator.clipboard.writeText(md);
2220
+ } else {
2221
+ // Fallback for older browsers
2222
+ const ta = document.createElement('textarea');
2223
+ ta.value = md;
2224
+ ta.style.cssText = 'position:fixed;top:0;left:0;width:1px;height:1px;padding:0;border:none;outline:none;box-shadow:none;background:transparent;';
2225
+ document.body.appendChild(ta);
2226
+ ta.focus();
2227
+ ta.select();
2228
+ document.execCommand('copy');
2229
+ document.body.removeChild(ta);
2230
+ }
2231
+
2232
+ showTooltip('✓ Copied to clipboard!', 'success');
2233
+ } catch (err) {
2234
+ showTooltip('✗ Copy failed: ' + err.message, 'error');
2235
+ }
2236
+ });
2237
+
2238
+ function toggleDropdown() {
2239
+ isOpen ? closeDropdown() : openDropdown();
2240
+ }
2241
+
2242
+ function openDropdown() {
2243
+ isOpen = true;
2244
+ dropdown.classList.remove('hidden');
2245
+ // Force reflow before adding animation classes
2246
+ dropdown.offsetHeight;
2247
+ dropdown.classList.remove('opacity-0', 'scale-95');
2248
+ dropdown.classList.add('opacity-100', 'scale-100');
2249
+ if (arrow) arrow.style.transform = 'rotate(180deg)';
2250
+ }
2251
+
2252
+ function closeDropdown() {
2253
+ if (!isOpen) return;
2254
+ isOpen = false;
2255
+ dropdown.classList.remove('opacity-100', 'scale-100');
2256
+ dropdown.classList.add('opacity-0', 'scale-95');
2257
+ if (arrow) arrow.style.transform = '';
2258
+ // Hide after animation
2259
+ setTimeout(() => {
2260
+ if (!isOpen) dropdown.classList.add('hidden');
2261
+ }, 100);
2262
+ }
2263
+
2264
+ function showTooltip(message, type = 'success') {
2265
+ closeDropdown();
2266
+
2267
+ if (copyTooltip) {
2268
+ // Update tooltip content and styling based on type
2269
+ copyTooltip.setContent(message);
2270
+
2271
+ // Set theme based on success/error
2272
+ const theme = type === 'success' ? 'light-success' : 'light-error';
2273
+ copyTooltip.setProps({ theme: theme });
2274
+
2275
+ // Show tooltip
2276
+ copyTooltip.show();
2277
+
2278
+ // Hide after 2 seconds
2279
+ setTimeout(() => {
2280
+ if (copyTooltip) {
2281
+ copyTooltip.hide();
2282
+ // Reset to default content and theme
2283
+ setTimeout(() => {
2284
+ if (copyTooltip) {
2285
+ copyTooltip.setContent('Copy as Markdown');
2286
+ copyTooltip.setProps({ theme: 'light' });
2287
+ }
2288
+ }, 200);
2289
+ }
2290
+ }, 2000);
2291
+ }
2292
+ }
2293
+ });
2294
+ }
2295
+ })();
2296
+ </script>
2297
+
2298
+
2299
+
2300
+ </div>
2301
+
2302
+
2303
+
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">
2306
+ <div class="p-4">
2307
+ <div class="flex items-center gap-2 mb-3">
2308
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
2309
+ viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
2310
+ stroke-linejoin="round" class="lucide lucide-package h-4 w-4 text-amp-gray-600">
2311
+ <path d="m7.5 4.27 9 5.15"></path>
2312
+ <path
2313
+ d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z">
2314
+ </path>
2315
+ <path d="m3.3 7 8.7 5 8.7-5"></path>
2316
+ <path d="M12 22V12"></path>
2317
+ </svg>
2318
+ <h3 class="font-medium text-amp-gray-900 text-sm m-0">
2319
+ <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
+ </h3>
2324
+ </div>
2325
+ <div class="space-y-2.5">
2326
+ <div>
2327
+ <div class="text-xs text-amp-gray-500 mb-1">Package Name</div>
2328
+ <code class="block font-mono text-xs bg-white px-2 py-1.5 rounded border border-amp-gray-200 text-amp-gray-700 w-full overflow-x-auto">@amplitude/analytics-react-native</code>
2329
+ </div>
2330
+ <div class="flex justify-between items-center">
2331
+ <div>
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>
2334
+ </div>
2335
+ <div class="text-right">
2336
+ <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>
2338
+ </div>
2339
+ </div>
2340
+ </div>
2341
+ </div>
2342
+
2343
+
2344
+
2345
+ </div>
2346
+
2347
+
2348
+
2349
+ <script>
2350
+ document.addEventListener('DOMContentLoaded', function() {
2351
+ const bundleCards = document.querySelectorAll('[data-bundle-loader]');
2352
+
2353
+ // Skip if no cards need loading (server-side data was successful)
2354
+ if (bundleCards.length === 0) return;
2355
+
2356
+ bundleCards.forEach(async (card) => {
2357
+ const packageName = card.dataset.bundlePackage;
2358
+ const environment = card.dataset.environment;
2359
+
2360
+ try {
2361
+ let data;
2362
+ let dataSource = 'unknown';
2363
+
2364
+ // Only try Laravel API in local/development (NOT preview/production)
2365
+ if (environment === 'local' || environment === 'development') {
2366
+ try {
2367
+ const response = await fetch(`/api/bundle-phobia?package=${encodeURIComponent(packageName)}`);
2368
+ if (response.ok) {
2369
+ data = await response.json();
2370
+ if (data._bundlephobia_success) {
2371
+ dataSource = data._bundlephobia_cached ? 'laravel-cache' : 'laravel-live';
2372
+ updateBundleSuccess(card, data, dataSource);
2373
+ return;
2374
+ }
2375
+ }
2376
+ } catch (apiError) {
2377
+ console.warn('Laravel API not available, falling back to direct BundlePhobia API');
2378
+ }
2379
+ } else {
2380
+ console.log(`Skipping Laravel API for environment: ${environment}`);
2381
+ }
2382
+
2383
+ // Direct BundlePhobia API (works in all environments)
2384
+ const response = await fetch(`https://bundlephobia.com/api/size?package=${encodeURIComponent(packageName)}`);
2385
+
2386
+ if (response.ok) {
2387
+ const directData = await response.json();
2388
+ if (directData && directData.size) {
2389
+ // Transform direct API response to match our format
2390
+ const transformedData = {
2391
+ name: directData.name || packageName,
2392
+ version: directData.version || 'Latest',
2393
+ size_gzip_kb: directData.gzip ? Math.round(directData.gzip / 1024 * 100) / 100 : 'N/A'
2394
+ };
2395
+ dataSource = 'bundlephobia-direct';
2396
+ updateBundleSuccess(card, transformedData, dataSource);
2397
+ return;
2398
+ }
2399
+ }
2400
+
2401
+ // Both APIs failed
2402
+ showBundleError(card, packageName, 'Unable to fetch bundle data');
2403
+
2404
+ } catch (error) {
2405
+ console.warn('Bundle size fetch failed:', error);
2406
+ showBundleError(card, packageName, 'Network error');
2407
+ }
2408
+ });
2409
+
2410
+ function updateBundleSuccess(card, data, source) {
2411
+ card.querySelector('.bundle-version').innerHTML =
2412
+ `<div class="font-medium text-amp-gray-900">${data.version}</div>`;
2413
+ card.querySelector('.bundle-size').innerHTML =
2414
+ `<div class="font-medium text-amp-gray-900">${data.size_gzip_kb} kB</div>`;
2415
+
2416
+ // Add source indicator
2417
+ const sourceIndicator = getSourceIndicator(source, data);
2418
+ card.querySelector('h3').innerHTML += sourceIndicator;
2419
+
2420
+ // Mark as loaded
2421
+ card.removeAttribute('data-bundle-loader');
2422
+ card.setAttribute('data-bundle-loaded', 'true');
2423
+ }
2424
+
2425
+ function getSourceIndicator(source, data) {
2426
+ switch (source) {
2427
+ case 'laravel-cache':
2428
+ return '<span class="ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-0.5 rounded" title="Data from Laravel cache">Cached</span>';
2429
+ case 'laravel-live':
2430
+ return '<span class="ml-2 text-xs bg-green-100 text-green-700 px-2 py-0.5 rounded" title="Fresh data from Laravel">Live</span>';
2431
+ case 'bundlephobia-direct':
2432
+ return '<span class="ml-2 text-xs bg-yellow-100 text-yellow-700 px-2 py-0.5 rounded" title="Direct from BundlePhobia API">Direct</span>';
2433
+ default:
2434
+ return '';
2435
+ }
2436
+ }
2437
+
2438
+ function showBundleError(card, packageName, errorMessage) {
2439
+ const flexContainer = card.querySelector('.flex.justify-between');
2440
+ flexContainer.innerHTML = `
2441
+ <div class="p-3 bg-white border border-amp-gray-200 rounded text-sm text-amp-gray-700 w-full">
2442
+ <p class="m-0 mb-2"><strong>Bundle size information temporarily unavailable.</strong></p>
2443
+ <p class="m-0 text-xs text-amp-gray-600">
2444
+ Visit <a href="https://bundlephobia.com/package/${packageName}" target="_blank" class="text-amp-blue-600 underline">BundlePhobia</a>
2445
+ or <a href="https://npmjs.com/package/${packageName}" target="_blank" class="text-app-blue-600 underline">npm</a>
2446
+ for current package details.
2447
+ </p>
2448
+ </div>
2449
+ `;
2450
+
2451
+ card.removeAttribute('data-bundle-loader');
2452
+ card.setAttribute('data-bundle-loaded', 'error');
2453
+ }
2454
+ });
2455
+ </script>
2456
+
2457
+
2458
+
2459
+
2460
+
2461
+ <div class="sticky top-24 ml-8 text-sm js-toc">
2462
+ </div>
2463
+
2464
+ </div>
2465
+
2466
+
2467
+ </div>
2468
+ </div>
2469
+
2470
+ <div class="mt-12 mb-5 max-w-screen-xl mx-auto pl-8">
2471
+ <div class="inline-flex items-center">
2472
+ <span class="text-sm text-amp-gray-600 mr-4">Was this page helpful?</span>
2473
+ <div class="inline-flex flex-row-reverse items-center">
2474
+ <button @click="amplitude.track('Article rating')" class="article-rating inline-flex flex-row-reverse items-center">
2475
+
2476
+ <svg xmlns="http://www.w3.org/2000/svg"
2477
+ class="inline cursor-pointer"
2478
+ height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed">
2479
+ <path
2480
+ d="m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z">
2481
+ </path>
2482
+ </svg>
2483
+
2484
+ <svg xmlns="http://www.w3.org/2000/svg"
2485
+ class="inline cursor-pointer"
2486
+ height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed">
2487
+ <path
2488
+ d="m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z">
2489
+ </path>
2490
+ </svg>
2491
+
2492
+ <svg xmlns="http://www.w3.org/2000/svg"
2493
+ class="inline cursor-pointer"
2494
+ height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed">
2495
+ <path
2496
+ d="m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z">
2497
+ </path>
2498
+ </svg>
2499
+
2500
+ <svg xmlns="http://www.w3.org/2000/svg"
2501
+ class="inline cursor-pointer"
2502
+ height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed">
2503
+ <path
2504
+ d="m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z">
2505
+ </path>
2506
+ </svg>
2507
+
2508
+ <svg xmlns="http://www.w3.org/2000/svg"
2509
+ class="inline cursor-pointer"
2510
+ height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed">
2511
+ <path
2512
+ d="m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z">
2513
+ </path>
2514
+ </svg>
2515
+
2516
+ </button>
2517
+ </div>
2518
+ </div>
2519
+
2520
+
2521
+ <p class="text-xs text-amp-gray-600"><svg class="inline" xmlns="http://www.w3.org/2000/svg" width="20" height="21" viewBox="0 0 20 21" fill="none"><g id="schedule"><mask id="mask0_388_26358" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="21"><rect id="Bounding box" y="0.987793" width="20" height="20" fill="#D9D9D9"/></mask><g mask="url(#mask0_388_26358)"><path id="schedule_2" d="M12.7917 14.5295L13.8542 13.467L10.75 10.3628V5.98779H9.25V10.9878L12.7917 14.5295ZM10 18.9878C8.89756 18.9878 7.86153 18.7795 6.89192 18.3628C5.92231 17.9461 5.07292 17.3732 4.34375 16.644C3.61458 15.9149 3.04167 15.0645 2.625 14.0928C2.20833 13.1212 2 12.083 2 10.9783C2 9.8735 2.20833 8.83502 2.625 7.86279C3.04167 6.89057 3.61458 6.04335 4.34375 5.32113C5.07292 4.5989 5.92332 4.02946 6.89496 3.61279C7.86661 3.19613 8.90481 2.98779 10.0095 2.98779C11.1143 2.98779 12.1528 3.19779 13.1251 3.61779C14.0974 4.03779 14.9432 4.60779 15.6625 5.32779C16.3817 6.04779 16.9511 6.89446 17.3707 7.86779C17.7902 8.84113 18 9.88113 18 10.9878C18 12.0902 17.7917 13.1263 17.375 14.0959C16.9583 15.0655 16.3889 15.9149 15.6667 16.644C14.9444 17.3732 14.0963 17.9461 13.1223 18.3628C12.1482 18.7795 11.1075 18.9878 10 18.9878ZM10.0099 17.4878C11.8082 17.4878 13.3395 16.8524 14.6037 15.5815C15.8679 14.3107 16.5 12.7761 16.5 10.9779C16.5 9.17956 15.8679 7.64831 14.6037 6.38411C13.3395 5.1199 11.8082 4.48779 10.0099 4.48779C8.21165 4.48779 6.67708 5.1199 5.40625 6.38411C4.13542 7.64831 3.5 9.17956 3.5 10.9779C3.5 12.7761 4.13542 14.3107 5.40625 15.5815C6.67708 16.8524 8.21165 17.4878 10.0099 17.4878Z" fill="#5A5E68"/></g></g></svg> July 23rd, 2024</p>
2522
+ </div>
2523
+
2524
+ <div class="pl-8 border-y border-y-amp-gray-100 py-[2.12rem] gap-2">
2525
+ <div class="flex flex-col max-w-screen-xl mx-auto">
2526
+ <div><svg class="inline" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg> <p class="text-[0.875rem] text-amp-gray-600 inline">Need help? <a href="https://help.amplitude.com/hc/en-us/requests/new" class="text-amp-blue-300" target="_blank">Contact Support</a></p></div>
2527
+ <div><svg class="inline" xmlns="http://www.w3.org/2000/svg" width="20" height="21" viewBox="0 0 20 21" fill="none"><g id="icon-amplitude"><path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M9.1805 7.21649C9.28367 7.3667 9.462 7.70394 9.72592 8.45712C9.90642 8.97243 10.1034 9.61079 10.3118 10.3556C9.52125 10.3442 8.72133 10.3356 7.94682 10.3275L7.55457 10.3232C7.99767 8.69717 8.53825 7.46332 8.93333 7.17198C8.95858 7.15678 8.99775 7.13881 9.04067 7.13881C9.0925 7.13881 9.13933 7.16553 9.1805 7.21649ZM15.3935 11.1677C15.393 11.1681 15.3924 11.1685 15.3918 11.169C15.3837 11.1756 15.3755 11.1819 15.3669 11.1878C15.3642 11.1897 15.3614 11.1917 15.3587 11.1936C15.3529 11.1973 15.347 11.2009 15.341 11.2043C15.3357 11.2075 15.3303 11.2108 15.3247 11.2137C15.3244 11.2139 15.324 11.214 15.3237 11.2142C15.2685 11.2433 15.2057 11.26 15.139 11.26H11.5864C11.6148 11.3784 11.6459 11.5129 11.6796 11.6593C11.8743 12.5048 12.3915 14.751 12.941 14.751L12.9517 14.7512L12.9578 14.7504L12.9683 14.7505C13.3974 14.7504 13.6165 14.1263 14.0966 12.759L14.1024 12.7425C14.1795 12.523 14.2666 12.2752 14.3608 12.013L14.3847 11.9462C14.4092 11.8808 14.4722 11.8344 14.5459 11.8344C14.6408 11.8344 14.7178 11.9118 14.7178 12.0073C14.7178 12.0245 14.7152 12.0413 14.7104 12.057L14.6906 12.1243C14.6404 12.287 14.5872 12.5087 14.5257 12.7653C14.2396 13.9579 13.8072 15.7596 12.6982 15.7596L12.6901 15.7595C11.9735 15.7539 11.5447 14.6017 11.3616 14.1097C11.0191 13.1897 10.76 12.2094 10.5101 11.26H7.23993L6.56109 13.4451L6.55113 13.4372C6.48906 13.5355 6.38018 13.5985 6.26002 13.5985C6.07048 13.5985 5.91552 13.4433 5.91467 13.2527L5.91509 13.2409L5.95619 12.9937C6.04997 12.4322 6.16233 11.8494 6.29045 11.26H4.90945L4.90435 11.2547C4.65368 11.2184 4.46117 10.996 4.46117 10.7368C4.46117 10.4825 4.64008 10.2661 4.88658 10.2221C4.90926 10.2192 4.95487 10.2153 5.04815 10.2153C5.06812 10.2153 5.09045 10.2155 5.11524 10.2159C5.55302 10.2235 6.01729 10.2305 6.52668 10.237C7.24757 7.29145 8.08242 5.79619 9.00842 5.79196C10.0022 5.79196 10.7393 8.06763 11.3294 10.2936L11.3317 10.3025C12.5441 10.3269 13.8364 10.3625 15.0926 10.4529L15.1452 10.4579C15.1654 10.4581 15.1852 10.4602 15.2045 10.4634L15.2118 10.4641C15.2141 10.4645 15.2161 10.4651 15.2182 10.4655C15.2193 10.4657 15.2205 10.466 15.2216 10.4662C15.4044 10.503 15.5401 10.6645 15.5401 10.8581C15.5401 10.9822 15.483 11.094 15.3935 11.1677ZM10 3.48779C5.85787 3.48779 2.5 6.86485 2.5 11.0306C2.5 15.1965 5.85787 18.5735 10 18.5735C14.1421 18.5735 17.5 15.1965 17.5 11.0306C17.5 6.86485 14.1421 3.48779 10 3.48779Z" fill="#5A5E68"/></g></svg> <p class="text-[0.875rem] text-amp-gray-600 inline">Visit <a href="https://www.amplitude.com" class="text-amp-blue-300" target="_blank">Amplitude.com</a></p></div>
2528
+ <div><svg class="inline" xmlns="http://www.w3.org/2000/svg" width="20" height="21" viewBox="0 0 20 21" fill="none"><g id="Icon Blog"><path id="Vector" d="M16.875 4.04193H3.125C2.39584 4.04193 1.80417 4.6336 1.80417 5.36276V16.6128C1.80417 17.3419 2.39584 17.9336 3.125 17.9336H16.875C17.6042 17.9336 18.1958 17.3419 18.1958 16.6128V5.36276C18.1958 4.6336 17.6042 4.04193 16.875 4.04193ZM16.8042 16.5419H3.2V5.43776H16.8042V16.5419ZM5.55417 8.48776C5.55417 8.10443 5.86667 7.79193 6.25 7.79193H13.75C14.1375 7.79193 14.4458 8.10443 14.4458 8.48776C14.4458 8.8711 14.1333 9.1836 13.75 9.1836H6.25C5.8625 9.1836 5.55417 8.8711 5.55417 8.48776ZM5.55417 10.9878C5.55417 10.6044 5.86667 10.2919 6.25 10.2919H13.75C14.1375 10.2919 14.4458 10.6044 14.4458 10.9878C14.4458 11.3711 14.1333 11.6836 13.75 11.6836H6.25C5.8625 11.6836 5.55417 11.3711 5.55417 10.9878ZM5.55417 13.4878C5.55417 13.1044 5.86667 12.7919 6.25 12.7919H13.75C14.1375 12.7919 14.4458 13.1044 14.4458 13.4878C14.4458 13.8711 14.1333 14.1836 13.75 14.1836H6.25C5.8625 14.1836 5.55417 13.8711 5.55417 13.4878Z" fill="#5A5E68"/></g></svg> <p class="text-[0.875rem] text-amp-gray-600 inline">Have a look at the Amplitude <a href="https://amplitude.com/blog" class="text-amp-blue-300" target="_blank">Blog</a></p></div>
2529
+ <div><svg class="inline" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg> <p class="text-[0.875rem] text-amp-gray-600 inline">Learn more at <a href="https://academy.amplitude.com/" class="text-amp-blue-300" target="_blank">Amplitude Academy</a></p></div>
2530
+
2531
+ </div>
2532
+ </div>
2533
+ <div class="pl-8 border-b border-b-amp-gray-100 flex flex-col py-[2.12rem] gap-2">
2534
+ <div class="flex flex-row justify-between items-center max-w-screen-xl">
2535
+ <div class="flex flex-row">
2536
+
2537
+ <a href="https://www.linkedin.com/company/amplitude-analytics" class="mr-4" target="_blank">
2538
+ <svg class="w-6 h-6 fill-amp-gray-600" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g id="Icon"><path id="Vector" d="M19.7778 2C20.3671 2 20.9324 2.23413 21.3491 2.65087C21.7659 3.06762 22 3.63285 22 4.22222V19.7778C22 20.3671 21.7659 20.9324 21.3491 21.3491C20.9324 21.7659 20.3671 22 19.7778 22H4.22222C3.63285 22 3.06762 21.7659 2.65087 21.3491C2.23413 20.9324 2 20.3671 2 19.7778V4.22222C2 3.63285 2.23413 3.06762 2.65087 2.65087C3.06762 2.23413 3.63285 2 4.22222 2H19.7778ZM19.2222 19.2222V13.3333C19.2222 12.3727 18.8406 11.4513 18.1613 10.772C17.482 10.0927 16.5607 9.71111 15.6 9.71111C14.6556 9.71111 13.5556 10.2889 13.0222 11.1556V9.92222H9.92222V19.2222H13.0222V13.7444C13.0222 12.8889 13.7111 12.1889 14.5667 12.1889C14.9792 12.1889 15.3749 12.3528 15.6666 12.6445C15.9583 12.9362 16.1222 13.3319 16.1222 13.7444V19.2222H19.2222ZM6.31111 8.17778C6.80618 8.17778 7.28098 7.98111 7.63104 7.63104C7.98111 7.28098 8.17778 6.80618 8.17778 6.31111C8.17778 5.27778 7.34444 4.43333 6.31111 4.43333C5.81309 4.43333 5.33547 4.63117 4.98332 4.98332C4.63117 5.33547 4.43333 5.81309 4.43333 6.31111C4.43333 7.34444 5.27778 8.17778 6.31111 8.17778ZM7.85556 19.2222V9.92222H4.77778V19.2222H7.85556Z"/></g></svg>
2539
+ </a>
2540
+
2541
+ <a href="https://twitter.com/Amplitude_HQ" class="mr-4" target="_blank">
2542
+ <svg class="w-6 h-6 fill-amp-gray-600" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><g id="Frame 4824"><path id="Vector" d="M24 4.29446C23.1166 4.69598 22.1644 4.95985 21.1778 5.08604C22.1874 4.47801 22.9675 3.51434 23.3346 2.35564C22.3824 2.92925 21.327 3.33078 20.2141 3.56023C19.3078 2.57361 18.0344 2 16.5889 2C13.8929 2 11.6902 4.20268 11.6902 6.92161C11.6902 7.31166 11.7361 7.69025 11.8164 8.04589C7.73231 7.83939 4.0956 5.87763 1.67495 2.90631C1.25048 3.62906 1.00956 4.47801 1.00956 5.37285C1.00956 7.08222 1.86998 8.59656 3.20077 9.45698C2.38623 9.45698 1.62906 9.22753 0.963671 8.88337C0.963671 8.88337 0.963671 8.88337 0.963671 8.91778C0.963671 11.304 2.66157 13.3002 4.91013 13.7476C4.49713 13.8623 4.06119 13.9197 3.61377 13.9197C3.30402 13.9197 2.99426 13.8853 2.69599 13.8279C3.31549 15.7667 5.11664 17.2122 7.2849 17.2467C5.60994 18.5774 3.48757 19.3576 1.17017 19.3576C0.780115 19.3576 0.390057 19.3346 0 19.2887C2.17973 20.6883 4.77247 21.5029 7.54876 21.5029C16.5889 21.5029 21.5564 14 21.5564 7.49522C21.5564 7.27725 21.5564 7.07075 21.5449 6.85277C22.5086 6.16444 23.3346 5.29254 24 4.29446Z"/></g></svg>
2543
+ </a>
2544
+
2545
+ <a href="https://www.g2.com/products/amplitude-analytics/reviews" class="mr-4" target="_blank">
2546
+ <svg class="w-6 h-6 fill-amp-gray-600" xmlns="http://www.w3.org/2000/svg" width="21" height="20" viewBox="0 0 21 20"><g id="Frame 4825"><path id="path8" d="M11.0327 20C6.57742 19.9883 2.69803 17.1751 1.42954 12.9766C0.37117 9.45907 1.056 6.24504 3.43733 3.43569C4.90037 1.70805 6.78365 0.649677 9.00155 0.198312C10.2428 -0.0546084 11.5191 -0.0662816 12.7642 0.167183C12.9043 0.194421 12.9043 0.22944 12.8498 0.342281C12.2389 1.61466 11.628 2.89094 11.0249 4.16721C10.9938 4.24892 10.9121 4.29951 10.8226 4.29172C8.19999 4.35787 5.95874 6.20224 5.39064 8.76257C4.77975 11.4824 6.25057 14.2957 8.8498 15.2957C10.9121 16.0856 12.8265 15.7704 14.5736 14.4202C14.6631 14.354 14.6981 14.3385 14.7642 14.4513C15.4335 15.6225 16.1066 16.7899 16.7876 17.9572C16.8459 18.0584 16.8265 18.105 16.737 18.1673C15.4218 19.0973 13.9043 19.6926 12.309 19.9066C11.8809 19.9572 11.4568 19.9883 11.0327 20Z"/><path id="path10" d="M17.9512 17.105C17.8967 17.0739 17.8812 17.0155 17.8539 16.9649C17.0913 15.6497 16.3364 14.3345 15.5815 13.0155C15.5271 12.9065 15.4103 12.8404 15.2897 12.852C13.78 12.8559 12.2702 12.852 10.7605 12.852H10.5737C10.5737 12.7937 10.5932 12.7392 10.6321 12.6964C11.3986 11.3657 12.1652 10.031 12.9356 8.70027C12.9784 8.61078 13.0718 8.5563 13.173 8.56797C14.7177 8.57186 16.2664 8.57186 17.8111 8.56797C17.9084 8.5563 18.0018 8.61078 18.0446 8.70027C18.815 10.0427 19.5893 11.3851 20.3675 12.7275C20.422 12.7976 20.422 12.8949 20.3753 12.9688C19.5932 14.319 18.815 15.6653 18.0407 17.0155C18.0096 17.0427 18.0018 17.0894 17.9512 17.105Z"/><path id="path12" d="M14.6983 2.95331C14.422 2.67704 14.1613 2.41245 13.8967 2.15175C13.815 2.07004 13.8734 2.01167 13.9084 1.94941C14.2158 1.41634 14.7139 1.01945 15.3014 0.844348C16.0213 0.606992 16.8111 0.684814 17.4726 1.05836C18.675 1.70817 18.5699 3.2179 17.8734 3.90273C17.6088 4.15565 17.3131 4.36966 16.9862 4.54087C16.6516 4.71986 16.317 4.88718 15.9901 5.07784C15.7177 5.23348 15.5076 5.44749 15.4065 5.76267C15.3676 5.88718 15.3909 5.9222 15.5232 5.91831C16.4065 5.91442 17.2936 5.91831 18.1769 5.91442C18.3092 5.91442 18.3598 5.94166 18.3559 6.08563C18.3442 6.39691 18.3481 6.71209 18.3559 7.02338C18.3559 7.12065 18.3287 7.15567 18.2275 7.15567C16.8072 7.15178 15.3831 7.15178 13.9629 7.15567C13.8967 7.15567 13.8345 7.15567 13.8345 7.0584C13.8345 6.07395 14.0174 5.15566 14.7878 4.45527C15.1535 4.12842 15.566 3.85993 16.0096 3.6537C16.2547 3.53308 16.4999 3.42024 16.71 3.24903C16.8967 3.09728 17.0251 2.9144 17.0368 2.66537C17.0563 2.27626 16.7489 1.99222 16.2858 1.96109C15.6205 1.91439 15.1419 2.21401 14.8033 2.77043C14.7722 2.81712 14.7411 2.8716 14.6983 2.95331Z"/><path id="path14" d="M18.0869 18.5058V18.1828H17.9702V18.1167H18.2776V18.1828H18.1609V18.5058H18.0869ZM18.3321 18.5058V18.1167H18.4488L18.515 18.3813L18.5811 18.1167H18.6978V18.5058H18.6317V18.2023L18.5539 18.5058H18.4799L18.4021 18.2023V18.5058H18.3321Z"/></g></svg>
2547
+ </a>
2548
+
2549
+ </div>
2550
+ <div class="flex flex-col pr-8">
2551
+ <div class="flex flex-row justify-between">
2552
+
2553
+ <a class="text-amp-gray-600 text-[0.875rem] font-[Gellix]" href="https://amplitude.com/terms" target="_blank">Terms of Service</a>
2554
+
2555
+ <a class="text-amp-gray-600 text-[0.875rem] font-[Gellix]" href="https://amplitude.com/privacy" target="_blank">Privacy Notice</a>
2556
+
2557
+ <a class="text-amp-gray-600 text-[0.875rem] font-[Gellix]" href="https://amplitude.com/aup" target="_blank">Acceptable Use Policy</a>
2558
+
2559
+ <a class="text-amp-gray-600 text-[0.875rem] font-[Gellix]" href="https://amplitude.com/legal" target="_blank">Legal</a>
2560
+
2561
+ </div>
2562
+ <div><p class="text-[0.815rem] text-amp-gray-600 opacity-80 font-[Gellix]">© 2026 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.</p></div>
2563
+ </div>
2564
+ </div>
2565
+ </div>
2566
+ </section>
2567
+ </div>
2568
+ </div>
2569
+
2570
+ </div>
2571
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.25.0/tocbot.min.js"></script>
2572
+ <script>
2573
+
2574
+ // Get all h2 and h3 elements
2575
+ var headings = document.querySelectorAll('h2, h3');
2576
+
2577
+ // Check if there are more than 3
2578
+ if (headings.length > 2) {
2579
+ // Execute your code here
2580
+ tocbot.init({
2581
+ // Where to render the table of contents.
2582
+ tocSelector: '.js-toc',
2583
+ // Where to grab the headings to build the table of contents.
2584
+ contentSelector: '.prose',
2585
+ // Which headings to grab inside of the contentSelector element.
2586
+ headingSelector: 'h2, h3',
2587
+ // For headings inside relative or absolute positioned containers within content.
2588
+ hasInnerContainers: true,
2589
+ ignoreSelector: '.hint-title, .js-toc-ignore',
2590
+ orderedList: false,
2591
+ ignoreHiddenElements: true,
2592
+ headingsOffset: 96,
2593
+ scrollSmoothOffset: -96
2594
+ }); }
2595
+
2596
+ </script>
2597
+
2598
+
2599
+
2600
+ <script src="https://cdn.jsdelivr.net/npm/@docsearch/js@4"></script>
2601
+ <script type="text/javascript">
2602
+ docsearch({
2603
+ appId: "93SYI9HL20",
2604
+ apiKey: "105a5cad34a7ac8f6a9fb78189d9c113",
2605
+ indexName: "amplitude-vercel",
2606
+ container: '#algolia-search-header',
2607
+ debug: true,
2608
+ placeholder: "Search 'instrumentation' , 'Export API'",
2609
+ transformItems(items) {
2610
+ return items.map((item) => ({
2611
+ ...item,
2612
+ url: item.url.replace('https://amplitude.com','')
2613
+ }))
2614
+ }
2615
+ });
2616
+
2617
+ // Amplitude tracking for DocSearch
2618
+ (function() {
2619
+ var lastQuery = '';
2620
+ var searchOpen = false;
2621
+
2622
+ document.addEventListener('click', function(e) {
2623
+ if (e.target.closest('.DocSearch-Button')) {
2624
+ amplitude.track('Search opened');
2625
+ searchOpen = true;
2626
+ }
2627
+ });
2628
+
2629
+ document.addEventListener('input', function(e) {
2630
+ var input = document.querySelector('.DocSearch-Input');
2631
+ if (input && e.target === input) {
2632
+ lastQuery = input.value;
2633
+ }
2634
+ });
2635
+
2636
+ // Use capture phase to run before DocSearch closes the modal
2637
+ document.addEventListener('click', function(e) {
2638
+ var hit = e.target.closest('.DocSearch-Hit');
2639
+ if (hit) {
2640
+ var query = lastQuery; // Capture query before any DOM changes
2641
+ var link = hit.querySelector('a');
2642
+ var url = link ? link.getAttribute('href') : '';
2643
+ var hits = document.querySelectorAll('.DocSearch-Hit');
2644
+ var position = Array.prototype.indexOf.call(hits, hit) + 1;
2645
+ amplitude.track('Search result clicked', { query: query, url: url, position: position });
2646
+ }
2647
+ }, true);
2648
+
2649
+ var observer = new MutationObserver(function(mutations) {
2650
+ var modal = document.querySelector('.DocSearch-Modal');
2651
+ if (searchOpen && !modal) {
2652
+ if (lastQuery) {
2653
+ amplitude.track('Search query', { query: lastQuery });
2654
+ }
2655
+ lastQuery = '';
2656
+ searchOpen = false;
2657
+ } else if (modal && !searchOpen) {
2658
+ // Track search opened for keyboard shortcuts (Cmd+K/Ctrl+K)
2659
+ amplitude.track('Search opened');
2660
+ searchOpen = true;
2661
+ }
2662
+ });
2663
+
2664
+ observer.observe(document.body, { childList: true, subtree: true });
2665
+ })();
2666
+ </script>
2667
+ <script src="/docs/js/site.js?id=078a82617f7dafffff92da951b4ec6c9"></script>
2668
+ <script src="/docs/js/statuspage.js?id=4da5c29a14b085ee38c353c2a7b7713c"></script>
2669
+
2670
+ <!-- Latest Version -->
2671
+ <script src="https://cc.cdn.civiccomputing.com/9/cookieControl-9.x.min.js" type="text/javascript"></script>
2672
+ <script>
2673
+ var config = {
2674
+ apiKey: "106b5e962520ab454786a0d1ba709e47372ef512",
2675
+ product: "PRO_MULTISITE",
2676
+ initialState: 'notify',
2677
+ notifyDismissButton: false,
2678
+ theme: 'light',
2679
+ setInnerHTML: true,
2680
+ branding: {
2681
+ fontFamily: 'IBM Plex Sans, sans-serif',
2682
+ backgroundColor: '#fafcfe',
2683
+ removeIcon: true,
2684
+ removeAbout: true,
2685
+ },
2686
+ statement: {
2687
+ description: 'See our',
2688
+ name: 'Privacy Notice',
2689
+ url: 'https://amplitude.com/privacy#cookies',
2690
+ updated: '25/04/2018',
2691
+ },
2692
+
2693
+ ccpaConfig: {
2694
+ description: 'See our',
2695
+ name: 'Personal Information Notice',
2696
+ url: 'https://amplitude.com/privacy',
2697
+ updated: '25/04/2018',
2698
+ },
2699
+
2700
+ ccpaConfig: {
2701
+ description: 'See our',
2702
+ name: 'Personal Information Notice',
2703
+ url: 'https://amplitude.com/privacy',
2704
+ updated: '25/04/2018',
2705
+ },
2706
+ text: {
2707
+ title: 'This site uses cookies.',
2708
+ intro: 'Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.',
2709
+ necessaryTitle: 'Necessary Cookies',
2710
+ necessaryDescription: 'Necessary cookies enable core functionality. The website cannot function properly without these cookies, and can only be disabled by changing your browser preferences.',
2711
+ accept: 'Accept',
2712
+ reject: 'Reject',
2713
+ rejectSettings: "Do Not Sell or Share My Personal Information",
2714
+
2715
+ // Regarding opening settings, "openCookieControl" should have been exposed
2716
+ // to the window by instrumentCookieControl() by, in the event it hasn't,
2717
+ // this falls back to CookieControl.open
2718
+ notifyDescription: `
2719
+ <div class="ccc-description">
2720
+ <div class="ccc-inner-description">
2721
+ <h2>Cookie Preferences</h2>
2722
+ <p>
2723
+ Sharing your cookies helps us improve site functionality and optimize your experience.
2724
+ <br><a href="https://amplitude.com/privacy#cookies" data-cta-clicked-type="interstitial" data-cc-policy>Click Here</a> to read our cookie policy.
2725
+ </p>
2726
+ </div>
2727
+ <div class="ccc-actions">
2728
+ <a class="ccc-manage-settings-btn" onclick="(window.openCookieControl || CookieControl.open)()"
2729
+ data-cta-clicked-type="interstitial"
2730
+ data-cc-settings>Manage Settings</a>
2731
+ <button onclick="CookieControl.acceptAll()" data-cc-accept data-cta-clicked-type="interstitial">
2732
+ Accept
2733
+ </button>
2734
+ </div>
2735
+ </div>`,
2736
+ },
2737
+ necessaryCookies: [
2738
+ '__utmzz', // utmz cookie replicator necessary to track utm google values
2739
+ '__utmzzses', // Also used by utmz cookie replciator
2740
+ 'corp_utm', // Own cookie used to persist utm values for Marketo
2741
+ 'membership_token_*', // Membership cookies for all access program
2742
+ 'sj_csrftoken', // Skill Jar Cookie
2743
+ ],
2744
+ optionalCookies: [{
2745
+ name: "performance",
2746
+ label: "Performance Cookies",
2747
+ description: 'We use these cookies to monitor and improve website performance.',
2748
+ cookies: [
2749
+ 'amplitude_id*', // Amplitude SDK
2750
+ 'amp_*', // Newer Amplitude SDK
2751
+ 'AMP_*', // Newer Amplitude SDK
2752
+ '1P_JAR', // Google Analytics
2753
+ 'DV', // Google Analytics
2754
+ 'NID', // Google Analytics
2755
+ 'OGPC', // Google Analytics
2756
+ '_ga', // Google Analytics
2757
+ '_gid', // Google Analytics
2758
+ '_gat*', // Google Analytics
2759
+ ],
2760
+ onRevoke: function () {
2761
+ amplitude.setOptOut(true)
2762
+ }
2763
+ },
2764
+ {
2765
+ name: "advertising",
2766
+ label: "Advertising Cookies",
2767
+ description: 'We use these cookies to help us improve the relevancy of advertising campaigns you receive.',
2768
+ cookies: [
2769
+ 'BizoID', // LinkedIn
2770
+ 'UserMatchHistory', // LinkedIn
2771
+ 'lang', // LinkedIn
2772
+ 'bcookie', // LinkedIn
2773
+ 'bscookie', // LinkedIn
2774
+ 'lidc', // LinkedIn
2775
+ 'fr', // Facebook
2776
+ 'vc', // AddThis
2777
+ 'uvc', // AddThis
2778
+ 'uid', // AddThis
2779
+ 'loc', // AddThis
2780
+ 'ouid', // AddThis
2781
+ 'di2', // AddThis
2782
+ '__atuvc', // AddThis
2783
+ '__atuvs', // AddThis
2784
+ '__d_mkto', // Marketo
2785
+ '_mkto_trk', // Marketo
2786
+ 'BIGipServerab13web-app_https', // Marketo
2787
+ 'IDE', // Doubleclick,
2788
+ 'csv', // Reddit
2789
+ 'edgebucket', // Reddit
2790
+ 'loid', // Reddit
2791
+ 'over18', // Reddit
2792
+ 'recent_srs', // Reddit
2793
+ 'session_tracker', // Reddit
2794
+ 'token_v2', // Reddit
2795
+ 'IDE', // Doubleclick
2796
+ '_uetsid', // Bing
2797
+ '_uetvid', // Bing
2798
+ '_uetsid_exp', // Bing
2799
+ '_uetvid_exp', // Bing
2800
+ '_uetmsclkid', // Bing
2801
+ '_clsk', // Bing
2802
+ 'sa-user-id', // Stackadapt
2803
+ 'sa-user-id-v2', // Stackadapt
2804
+ ],
2805
+ onAccept: function () {
2806
+
2807
+ },
2808
+ onRevoke: function () {
2809
+
2810
+ },
2811
+ }
2812
+ ]
2813
+ }
2814
+
2815
+ CookieControl.load(config);
2816
+ </script>
2817
+
2818
+ </body>
2819
+ </html>