Skip to content

Commit fb2623e

Browse files
Add info on retrieving anonymousId
1 parent db8b567 commit fb2623e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/connections/sources/catalog/libraries/mobile/react-native/implementation.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ Analytics React Native was built to be as extensible and customizable as possibl
203203
- [Handle errors](#handle-errors)
204204
- [Report errors from plugins](#report-errors-from-plugins)
205205
- [Native AnonymousId](#native-anonymousid)
206+
- [Retrieving AnonymousId](#retrieving-anonymousid)
206207
- [Configure iOS deep link tracking](#configure-ios-deep-link-tracking)
207208
- [Device identifiers](#device-identifiers)
208209

@@ -445,6 +446,14 @@ private AnalyticsReactNativePackage analytics = new AnalyticsReactNativePackage(
445446
analytics.setAnonymousId("My-New-Native-Id");
446447
}
447448
```
449+
### Retrieving AnonymousId
450+
The React Native library does not have a specific method for retrieving anonymousId. However, you can access this value by calling the following in your code:
451+
```js
452+
segmentClient.userInfo.get().anonymousId
453+
```
454+
455+
Retrieving the anonymousId can be useful if you need to pass this value to your backend, or if you are using a web view component with our AJS library and need to link user activity.
456+
448457
### Configure iOS deep link tracking
449458
> warning ""
450459
> This is only required for iOS if you're using the `trackDeepLinks` option. Android doesn't require any additional setup.

0 commit comments

Comments
 (0)