Skip to content

Commit d4335b1

Browse files
authored
Merge pull request #5746 from segmentio/ashton-huxtable-patch-3
Add info on retrieving anonymousId
2 parents 281d9c4 + da2bb55 commit d4335b1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ Analytics React Native was built to be as extensible and customizable as possibl
202202
- [React Native navigation](#react-native-navigation)
203203
- [Handle errors](#handle-errors)
204204
- [Report errors from plugins](#report-errors-from-plugins)
205-
- [Native AnonymousId](#native-anonymousid)
205+
- [Native anonymousId](#native-anonymousid)
206+
- [Retrieving the anonymousId](#retrieving-anonymousid)
206207
- [Configure iOS deep link tracking](#configure-ios-deep-link-tracking)
207208
- [Device identifiers](#device-identifiers)
208209

@@ -445,6 +446,15 @@ private AnalyticsReactNativePackage analytics = new AnalyticsReactNativePackage(
445446
analytics.setAnonymousId("My-New-Native-Id");
446447
}
447448
```
449+
### Retrieving the anonymousId
450+
The React Native library does not have a specific method for retrieving the anonymousId. However, you can access this value by calling the following in your code:
451+
452+
```js
453+
segmentClient.userInfo.get().anonymousId
454+
```
455+
456+
Retrieving the anonymousId can be useful if you need to pass this value to your backend, or if you're using a web view component with Segment's Analytics.js library and need to link user activity.
457+
448458
### Configure iOS deep link tracking
449459
> warning ""
450460
> 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)