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/classic.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,19 @@ hidden: true
6
6
> info "Analytics for React Native 2.0"
7
7
> Analytics for React Native 2.0 is available. For more information, see the [Analytics for React Native 2.0 GitHub repository](https://github.com/segmentio/analytics-react-native){:target="_blank"}.
8
8
9
-
Analytics for React Native makes it easy to send your data to any analytics or marketing tool without having to learn, test or implement a new API every time.
9
+
Analytics for React Native makes it easy to send your data to any analytics or marketing tool without having to learn, test, or implement a new API every time.
10
10
11
11
All of Segment's libraries are open-source, and you can [view Analytics for React Native on GitHub](https://github.com/segmentio/analytics-react-native){:target="_blank"}, or see a list of the other [Segment browser and server libraries](/docs/connections/sources/catalog/){:target="_blank"} too.
12
12
13
13
> info ""
14
-
> You can subscribe to the [release feed](https://github.com/segmentio/analytics-react-native/tags.atom) to keep up to date with the latest releases.
14
+
> You can subscribe to the [release feed](https://github.com/segmentio/analytics-react-native/tags.atom){:target="_blank"} to keep up to date with the latest releases.
15
15
16
16
In cloud-mode, Analytics-React-Native functions as a normal Segment library. In device-mode it wraps the Segment [Analytics-iOS](/docs/connections/sources/catalog/libraries/mobile/ios/) and [Analytics-Android](/docs/connections/sources/catalog/libraries/mobile/android/) libraries, and loads the appropriate mobile library depending on the user's platform. Because of this, Analytics-React-Native includes the two mobile libraries as dependencies.
17
17
18
18
> warning ""
19
-
> When you bundle a destination’s device-mode SDK, the React Native library serves as a wrapper for the iOS or Android source libraries. To access the underlying destination code, it is necessary to write bridging code between the React Native wrapper, and the destination’s SDK.
19
+
> When you bundle a destination’s device-mode SDK, the React Native library serves as a wrapper for the iOS or Android source libraries. To access the underlying destination code, it's necessary to write bridging code between the React Native wrapper and the destination’s SDK.
20
20
>
21
-
> For example, if to configure deep linking or retrieve the Appsflyer ID in Appsflyer, or configure in-app messages or push notifications in Braze, you must write code to specifically access these methods from the destination SDK.
21
+
> For example, to configure deep linking or retrieve the Appsflyer ID in Appsflyer, or configure in-app messages or push notifications in Braze, you must write code to specifically access these methods from the destination SDK.
22
22
23
23
### Analytics-React-Native and Unique Identifiers
24
24
@@ -28,7 +28,7 @@ One of the most important parts of any analytics platform is the ability to cons
28
28
29
29
Apple restricts how you can generate and use unique IDs to help protect end-users' privacy. Segment generates IDs while remaining in compliance with Apple's policies.
30
30
31
-
Before iOS 5 developers had access to `uniqueIdentifier`, which was a hardware-specific serial number that was consistent across different apps, vendors and installs. Starting with iOS 5, however, [Apple deprecated access to this identifier](https://developer.apple.com/news/?id=3212013a){:target="_blank"}. In iOS 6 Apple introduced the `identifierForVendor` which protects end-users from cross-app identification. In iOS 7 Apple [restricted access to the device’s MAC address](http://techcrunch.com/2013/06/14/ios-7-eliminates-mac-address-as-tracking-option-signaling-final-push-towards-apples-own-ad-identifier-technology/){:target="_blank"}, which many developers used as a workaround to get a similar device-specific serial number to replace `uniqueIdentifier`.
31
+
Before iOS 5, developers had access to `uniqueIdentifier`, which was a hardware-specific serial number that was consistent across different apps, vendors, and installs. Starting with iOS 5, however, [Apple deprecated access to this identifier](https://developer.apple.com/news/?id=3212013a){:target="_blank"}. In iOS 6, Apple introduced the `identifierForVendor` which protects end-users from cross-app identification. In iOS 7, Apple [restricted access to the device’s MAC address](http://techcrunch.com/2013/06/14/ios-7-eliminates-mac-address-as-tracking-option-signaling-final-push-towards-apples-own-ad-identifier-technology/){:target="_blank"}, which many developers used as a workaround to get a similar device-specific serial number to replace `uniqueIdentifier`.
32
32
33
33
Segment’s iOS library supports iOS 7+ by generating a UUID and storing it on disk. This complies with Apple’s required privacy policies, maintains compatibility, and also enables correct tracking in situations where multiple people use the same device, since the UUID can be regenerated.
Segment only supports sending data to bundled, device-mode destinations if you are using Cocoapods to manage your dependencies. Our Support staff cannot answer questions about, and are not responsible for, projects that do not use Cocoapods.
97
+
Segment only supports sending data to bundled, device-mode destinations if you're using Cocoapods to manage your dependencies. Our Support staff cannot answer questions about, and are not responsible for, projects that do not use Cocoapods.
98
98
99
99
If you absolutely cannot use Cocoapods, you can manually install our dynamic framework which allows you to send data to Segment, and have Segment send it on to enabled cloud-mode destinations.
100
100
@@ -110,7 +110,7 @@ To install Analytics-React-native manually:
110
110
111
111
### Packaging Destinations using Device-mode
112
112
113
-
By default, Analytics-React-Native sends all of your data first to the Segment servers, which forward the data on to any tools you enabled from the Segment web app. It does not package any external destination code by default. This is known as sending your data using "Cloud-mode", and it helps reduce the size of your project.
113
+
By default, Analytics-React-Native sends all of your data first to the Segment servers, which forward the data on to any tools you enabled from the Segment web app. It doesn't package any external destination code by default. This is known as sending your data using "Cloud-mode", and it helps reduce the size of your project.
114
114
115
115
However, some destinations require that you include code in your project that can be run on the user's device so that these tools can function correctly. These destinations send data directly to the destination's API endpoints, as well as sending a copy to the Segment servers for archiving. This is known as sending data in "device-mode". Other destinations offer a device-mode SDK, but still work (with reduced features) in cloud-mode.
116
116
@@ -122,7 +122,7 @@ You can read [more about connection modes](/docs/connections/destinations/#conne
122
122
To use a device-mode destination, you add the destination's SDK to the project. You can find information about these in the destination information pages in the Segment app. Any mobile destination with a Device-mode option includes information on how to bundle SDK.
123
123
124
124
> warning ""
125
-
> **Good to know**: Not all destinations have a device-mode package available for use with React Native. [See the list below](#destinations-that-support-device-mode-for-react-native). If a destination you want to use does not offer a React Native SDK, you can usually still use it in cloud-mode instead.
125
+
> **Good to know**: Not all destinations have a device-mode package available for use with React Native. [See the list below](#destinations-that-support-device-mode-for-react-native). If a destination you want to use doesn't offer a React Native SDK, you can usually still use it in cloud-mode instead.
126
126
127
127
When you bundle a destination's device-mode SDK, Segment's React Native library source serves as a wrapper for the iOS and Android source libraries. The React Native device mode SDKs you bundle are generated from the iOS and Android ones.
> If you are bundling several device-mode destinations in your project, you might want to make a checklist to make sure you add the relevant dependencies, and add import statements.
136
+
> If you are bundling several device-mode destinations in your project, you might want to make a checklist to make sure you add the relevant dependencies and add import statements.
137
137
138
138
See the [device mode documentation in the React Native readme](https://github.com/segmentio/analytics-react-native/#packaging-device-mode-destination-sdks){:target="_blank"} for more details.
139
139
@@ -188,7 +188,7 @@ Now that the library is installed and some SDKs are set up, you're ready to lear
188
188
189
189
### Identify
190
190
191
-
The [Identify call](/docs/connections/spec/identify/) lets you tie a user to their actions, and record traits about them. It includes a unique User ID, and any optional traits you know about them.
191
+
The [Identify call](/docs/connections/spec/identify/) lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them.
192
192
193
193
Segment recommends that you make an Identify call when the user first creates an account, and when they update their information. If users can log out of your app, you should call `identify` when a user logs back in.
194
194
@@ -197,7 +197,7 @@ Analytics-React-Native works on its own background thread, so it never blocks th
197
197
> note ""
198
198
> **Note**: Segment automatically assigns an `anonymousId` to users before you identify them. The `userId` is what connects anonymous activities across devices.
199
199
200
-
The example Identify call below identifies a user by their unique User ID (the one you know them by in your database), and labels them with a `name` and `email` traits.
200
+
The example Identify call below identifies a user by their unique User ID (the one you know them by in your database), and labels them with `name` and `email` traits.
201
201
202
202
```js
203
203
analytics.identify("a user's id", {
@@ -270,7 +270,7 @@ You can read more about the Track call fields on [the Segment Spec page about th
270
270
271
271
The [Screen call](/docs/connections/spec/screen/) lets you you record whenever a user sees a screen of your mobile app, along with optional extra information about the page being viewed. This is very similar to the [Page call](/docs/connections/spec/page/) that you would use for non-mobile users.
272
272
273
-
Record a screen event an event whenever the user opens or navigates to a new screen in your app. This could be a view, fragment, dialog or activity depending on your app.
273
+
Record a screen event whenever the user opens or navigates to a new screen in your app. This could be a view, fragment, dialog, or activity depending on your app.
274
274
275
275
The example Screen call below shows a user viewed the Photo Feed, and that the page was private.
276
276
@@ -297,9 +297,9 @@ You can read more about the Screen call fields on [the Segment Spec page about t
297
297
298
298
### Group
299
299
300
-
The [Group call](/docs/connections/spec/group/) lets you associate an [identified user](#identify) user with a group. A group could be a company, organization, account, project or team. The call also lets you record custom traits about the group, like industry or number of employees.
300
+
The [Group call](/docs/connections/spec/group/) lets you associate an [identified user](#identify) user with a group. A group could be a company, organization, account, project, or team. The call also lets you record custom traits about the group, like industry or number of employees.
301
301
302
-
The Group call is useful for tools like [Intercom](/docs/connections/destinations/catalog/intercom/), [Preact](/docs/connections/destinations/catalog/preact/) and [Totango](/docs/connections/destinations/catalog/totango/), as it ties the user to a **group** of other users.
302
+
The Group call is useful for tools like [Intercom](/docs/connections/destinations/catalog/intercom/), [Preact](/docs/connections/destinations/catalog/preact/), and [Totango](/docs/connections/destinations/catalog/totango/), as it ties the user to a **group** of other users.
303
303
304
304
The example Group call below adds the current user to the `myGroup` group, and adds a name and description.
305
305
@@ -327,7 +327,7 @@ You can read more about the Group method, including the group call payload, in [
327
327
328
328
### Alias
329
329
330
-
You can use Alias calls to link one identity with another. This is an advanced method, but it is required to manage user identities correctly in *some* destinations.
330
+
You can use Alias calls to link one identity with another. This is an advanced method, but it's required to manage user identities correctly in *some* destinations.
331
331
332
332
In [Mixpanel](/docs/connections/destinations/catalog/mixpanel/#alias) it's used to associate an anonymous user with an identified user once they sign up. For [Kissmetrics](/docs/connections/destinations/catalog/kissmetrics/#alias), if your user switches IDs, you can use 'alias' to rename the 'userId'.
333
333
@@ -405,7 +405,7 @@ analytics.reset()
405
405
406
406
### Flush
407
407
408
-
By default, the library collects 20 events in the queue before flushing (sending) them, but you modify this number.
408
+
By default, the library collects 20 events in the queue before flushing (sending) them, but you can modify this number.
409
409
410
410
You can set `flushAt` to `1` to send events as they come in, and not in batches. This approach uses more battery.
In some cases, you might want to add information to [the `context` object](/docs/connections/spec/common/#context) in the Segment message payload. This can be useful for adding context or session data for an event that doesn't have another logical place to add it, such as in an Identify, Screen or Group.
451
+
In some cases, you might want to add information to [the `context` object](/docs/connections/spec/common/#context) in the Segment message payload. This can be useful for adding context or session data for an event that doesn't have another logical place to add it, such as in an Identify, Screen, or Group.
By default, events are delivered to any cloud-mode destinations currently enabled in the Segment web app. You can override this delivery by adding a list to exclude, as in the example above. In this example, the event does not reach the Mixpanel destination.
467
+
By default, events are delivered to any cloud-mode destinations currently enabled in the Segment web app. You can override this delivery by adding a list to exclude, as in the example above. In this example, the event doesn't reach the Mixpanel destination.
468
468
469
469
> success ""
470
-
> **Tip!** Items in the Integrations object are **case sensitive** and must match the actual destination name. Many destination documentation pages include a list of acceptable names when the correct name is not clear.
470
+
> **Tip!** Items in the Integrations object are **case sensitive** and must match the actual destination name. Many destination documentation pages include a list of acceptable names when the correct name isn't clear.
471
471
472
472
## Identity and privacy
473
473
@@ -487,7 +487,7 @@ If a user opts back in at a later date, you can re-enable data collection using
487
487
analytics.enable()
488
488
```
489
489
490
-
When you disable the Segment library, all data collection methods (`track`, `identify`, etc) stop running; however, it does not remove the initialized libraries. If you bundle device-mode SDKs which collect data automatically, or outside of Segment, those continue to operate. Segment recommends that you invoke a disable method in each of packaged SDK when a user opts-out, to ensure all automatic data collection stops.
490
+
When you disable the Segment library, all data collection methods (`track`, `identify`, etc) stop running; however, it doesn't remove the initialized libraries. If you bundle device-mode SDKs which collect data automatically, or outside of Segment, those continue to operate. Segment recommends that you invoke a disable method in each of packaged SDK when a user opts-out, to ensure all automatic data collection stops.
491
491
492
492
### Anonymizing IP
493
493
@@ -524,7 +524,7 @@ React Native doesn't provide an official JavaScript API to handle push notificat
524
524
525
525
### React Native push notifications on iOS
526
526
527
-
For services that send push notifications, you first want to [create a Push SSL certificate following these steps](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html){:target="_blank"}. You then want to configure your application delegate to look like the code below, and replace your Segment source write key.
527
+
For services that send push notifications, you first want to [create a Push SSL certificate following these steps](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html){:target="_blank"}. You then want to configure your application delegate to look like the code below and replace your Segment source write key.
0 commit comments