You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/mobile/react-native/implementation.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,6 +206,7 @@ Analytics React Native was built to be as extensible and customizable as possibl
206
206
-[Retrieving the anonymousId](#retrieving-anonymousid)
207
207
-[Configure iOS deep link tracking](#configure-ios-deep-link-tracking)
208
208
-[Device identifiers](#device-identifiers)
209
+
-[Using a WebView Component with React Native](#using-a-webview-component-with-react-native)
209
210
210
211
### Control upload with flush policies
211
212
@@ -477,5 +478,21 @@ On Android, Segment's React Native library generates a unique ID by using the DR
477
478
478
479
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.
479
480
481
+
### Using a WebView Component with React Native
482
+
483
+
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.
484
+
485
+
To retrieve and pass the anonymousId:
486
+
487
+
1. Retrieve anonymousId from the React Native library using:
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:
492
+
```text
493
+
http://segment.com/?ajs_aid={anonymousId}
494
+
```
495
+
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.
496
+
480
497
## Changelog
481
498
[View the Analytics React Native changelog on GitHub](https://github.com/segmentio/analytics-react-native/releases){:target="_blank"}.
0 commit comments