diff --git a/.github/workflows/link-check-config.json b/.github/workflows/link-check-config.json index 7cd53058a..da7a0206b 100644 --- a/.github/workflows/link-check-config.json +++ b/.github/workflows/link-check-config.json @@ -39,6 +39,12 @@ }, + { + + "pattern": "https://badge.fury.io" + + }, + { "pattern": "/analytics/apis/http-v2-api/" } diff --git a/docs/analytics/dynamic-configuration.md b/docs/analytics/dynamic-configuration.md index 0060929af..72e448a81 100644 --- a/docs/analytics/dynamic-configuration.md +++ b/docs/analytics/dynamic-configuration.md @@ -4,7 +4,8 @@ description: Use dynamic configuration to find the best server URLs based on a u --- -Some Amplitude SDK versions (iOS 5.3.0+, Android 2.28.0+, and JavaScript 8.9.0+, Unity, Flutter) let you set your apps to use dynamic configuration. +Some Amplitude SDK versions (iOS 5.3.0+, Android 2.28.0+, JavaScript 8.9.0+, React Native, Unity, and Flutter) let you set your apps to use dynamic configuration. + Dynamic configuration finds the best Amplitude server URL based on app users' location. ## Considerations @@ -72,6 +73,12 @@ Enable the `useDynamicConfig` flag. }); ``` +=== "React Native" + + ```ts + Amplitude.getInstance().setUseDynamicConfig(true); + ``` + === "Unity" ```c# diff --git a/docs/analytics/sdks/react-native-sdk.md b/docs/analytics/sdks/react-native-sdk.md new file mode 100644 index 000000000..48f70b096 --- /dev/null +++ b/docs/analytics/sdks/react-native-sdk.md @@ -0,0 +1,406 @@ +--- +title: React Native SDK +description: Official documentation for the Amplitude Analytics React Native SDK. +icon: fontawesome/brands/react +--- + + +![npm version](https://badge.fury.io/js/%40amplitude%2Freact-native.svg) + +This is the official documentation for the Amplitude Analytics React Native SDK. + +???info "SDK Resources" + - [React SDK Reference :material-book:](https://amplitude.github.io/Amplitude-ReactNative/) + - [React SDK Repository :material-github:](https://github.com/amplitude/Amplitude-ReactNative) + - [React SDK Releases :material-code-tags-check:](https://github.com/amplitude/Amplitude-ReactNative/releases) + +--8<-- "includes/ampli-vs-amplitude.md" + +## SDK installation + +### Add dependencies + +Run `yarn add @amplitude/react-native` in your project directory, the same level with `package.json`. + +```bash +yarn add @amplitude/react-native@latest +``` + +### iOS installation + +```bash +cd /ios && pod install +``` + +## Usage and examples + +### Initialization + +Before you can instrument, you must initialize the SDK using the API key for your Amplitude project. + +=== "TypeScript" + + ```ts + import * as React from 'react'; + import { Button } from 'react-native'; + import { Amplitude, Identify } from '@amplitude/react-native'; + + const ampInstance = Amplitude.getInstance(); + ampInstance.init(API_KEY); + + export function MyApp() { + return ( +