Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Analytics React Native was built to be as extensible and customizable as possibl
- [Native AnonymousId](#native-anonymousid)
- [Configure iOS deep link tracking](#configure-ios-deep-link-tracking)
- [Device identifiers](#device-identifiers)
- [Using a WebView Component with React Native](#using-a-webview-component-with-react-native)

### Control upload with flush policies

Expand Down Expand Up @@ -467,5 +468,21 @@ On Android, Segment's React Native library generates a unique ID by using the DR

To collect the Android Advertising ID provided by Play Services, Segment provides a [plugin](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-advertising-id){:target="_blank"} that can be used to collect that value. This value is set to context.device.advertisingId. For iOS, this [plugin](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins/plugin-idfa){:target="_blank"} can be used to set the IDFA context.device.advertisingId property.

### Using a WebView Component with React Native

If you use a webView component in your app that uses Segment's [Analytics.js](/docs/connections/sources/catalog/libraries/website/javascript/){:target="_blank"} library, you can use Segment's [Querystring API](/docs/connections/sources/catalog/libraries/website/javascript/querystring/){:target="_blank"} to pass the anonymousId from your React Native app to Analytics.js to ensure activity from anonymous users can be linked across these two sources.

To retrieve and pass the anonymousId:

1. Retrieve anonymousId from the React Native library using:
```js
const anonymousId = segmentClient.userInfo.get().anonymousId
```
2. Pass this value into the querystring that opens the webview using the `ajs_aid` optional query string parameter noted in the documentation above. For example, the URL that opens your webview might look like:
```text
http://segment.com/?ajs_aid={anonymousId}
```
3. When a user clicks the element that opens the webview, Analytics.js will read that parameter and automatically set the anonymousId to whatever value is passed in, linking your events across both libraries to the same user.

## Changelog
[View the Analytics React Native changelog on GitHub](https://github.com/segmentio/analytics-react-native/releases){:target="_blank"}.