Skip to content

Commit f8c110f

Browse files
committed
[netlify-build]
1 parent d0a0666 commit f8c110f

File tree

3 files changed

+67
-57
lines changed

3 files changed

+67
-57
lines changed

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

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ hidden: true
66
> info "Analytics for React Native 2.0"
77
> 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"}.
88
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.
1010

1111
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.
1212

@@ -16,9 +16,9 @@ All of Segment's libraries are open-source, and you can [view Analytics for Reac
1616
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.
1717

1818
> 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's 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 is necessary to write bridging code between the React Native wrapper, and the destination’s SDK.
2020
>
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.
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.
2222
2323
### Analytics-React-Native and Unique Identifiers
2424

@@ -28,7 +28,7 @@ One of the most important parts of any analytics platform is the ability to cons
2828

2929
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.
3030

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`.
3232

3333
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.
3434

@@ -66,37 +66,36 @@ To add CocoaPods to your app, follow [these instructions](https://facebook.githu
6666

6767
### Install the SDK
6868

69-
Segment recommends that you use NPM to install Analytics for React Native. This allows you to create a build with specific destinations, and makes it much easier to install and upgrade the library and any components.
69+
Segment recommends that you use NPM to install Analytics for React Native. This allows you to create a build with specific destinations, and makes it much easier to install and upgrade the library and any components. To install the SDK:
7070

71-
First, add the `@segment/analytics-react-native` dependency to your `dependencies` and link it using `react-native-cli`, using the example commands below.
71+
1. Add the `@segment/analytics-react-native` dependency to your `dependencies` and link it using `react-native-cli`, using the example commands below.
7272

73-
```bash
74-
$ yarn add @segment/analytics-react-native
75-
$ yarn react-native link
76-
```
73+
```bash
74+
$ yarn add @segment/analytics-react-native
75+
$ yarn react-native link
76+
```
7777

78-
Then in your application, set up the library as in the example below.
78+
2. In your application, set up the library as in the example below.
7979

80-
```js
81-
await analytics.setup('YOUR_WRITE_KEY', {
82-
// Record screen views automatically!
83-
recordScreenViews: true,
84-
// Record certain application events automatically!
85-
trackAppLifecycleEvents: true
86-
})
87-
```
88-
89-
Next, make sure you import Analytics-React-Native in any files that you want to use it in. You can use an `import` statement like the example below.
80+
```js
81+
await analytics.setup('YOUR_WRITE_KEY', {
82+
// Record screen views automatically!
83+
recordScreenViews: true,
84+
// Record certain application events automatically!
85+
trackAppLifecycleEvents: true
86+
})
87+
```
88+
3. Make sure you import Analytics-React-Native in any files that you use want to it in. You can use an `import` statement like the example below.
9089

9190
```js
9291
import analytics from '@segment/analytics-react-native'
9392
```
9493

9594
### Dynamic Framework for Manual Installation
9695

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.
96+
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.
9897

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.
98+
If you can't use Cocoapods, you can manually install Segment's dynamic framework which allows you to send data to Segment, and have Segment send it on to enabled cloud-mode destinations.
10099

101100
To install Analytics-React-native manually:
102101

@@ -105,12 +104,12 @@ To install Analytics-React-native manually:
105104
![Embed Analytics.framework](images/embed-analytics-framework.png)
106105

107106
> warning ""
108-
> **Note**: if you choose not to use a dependency manager, you must keep all of the files up-to-date with regularly scheduled, manual updates.
107+
> **Note**: If you choose not to use a dependency manager, you must keep all of the files up-to-date with regularly scheduled, manual updates.
109108

110109

111110
### Packaging Destinations using Device-mode
112111

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.
112+
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.
114113

115114
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.
116115

@@ -119,7 +118,7 @@ You can read [more about connection modes](/docs/connections/destinations/#conne
119118
> success ""
120119
> **Tip!** Segment recommends that you use Device-mode destinations only when necessary to use device-specific features, so you can reduce the size of your application.
121120

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.
121+
To use a device-mode destination, 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.
123122
124123
> warning ""
125124
> **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.
@@ -133,7 +132,7 @@ yarn add @segment/analytics-react-native-{bugsnag,branch,firebase}
133132
```
134133

135134
> tip "Tip!"
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.
135+
> 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.
137136

138137
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.
139138

@@ -188,7 +187,7 @@ Now that the library is installed and some SDKs are set up, you're ready to lear
188187

189188
### Identify
190189

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.
190+
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.
192191

193192
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.
194193

@@ -197,7 +196,7 @@ Analytics-React-Native works on its own background thread, so it never blocks th
197196
> note ""
198197
> **Note**: Segment automatically assigns an `anonymousId` to users before you identify them. The `userId` is what connects anonymous activities across devices.
199198

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.
199+
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.
201200

202201
```js
203202
analytics.identify("a user's id", {
@@ -270,7 +269,7 @@ You can read more about the Track call fields on [the Segment Spec page about th
270269
271270
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.
272271
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.
272+
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.
274273
275274
The example Screen call below shows a user viewed the Photo Feed, and that the page was private.
276275
@@ -297,9 +296,9 @@ You can read more about the Screen call fields on [the Segment Spec page about t
297296
298297
### Group
299298
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.
299+
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.
301300
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.
301+
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.
303302
304303
The example Group call below adds the current user to the `myGroup` group, and adds a name and description.
305304
@@ -327,7 +326,7 @@ You can read more about the Group method, including the group call payload, in [
327326
328327
### Alias
329328
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.
329+
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.
331330
332331
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'.
333332

@@ -405,7 +404,7 @@ analytics.reset()
405404

406405
### Flush
407406

408-
By default, the library collects 20 events in the queue before flushing (sending) them, but you can modify this number.
407+
By default, the library collects 20 events in the queue before flushing (sending) them, but you modify this number.
409408

410409
You can set `flushAt` to `1` to send events as they come in, and not in batches. This approach uses more battery.
411410

@@ -433,7 +432,7 @@ await analytics.setup('YOUR_WRITE_KEY', {
433432
})
434433
```
435434

436-
By default, debug logging is disabled.
435+
By default debug logging is disabled.
437436

438437

439438
### Application Lifecycle Tracking
@@ -448,7 +447,7 @@ await analytics.setup('YOUR_WRITE_KEY', {
448447
449448
### Adding data to the context
450449
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.
450+
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.
452451

453452
```js
454453
analytics.identify('brandon', null, { context: { myValue: false, loginFailures: 3 }})
@@ -464,10 +463,10 @@ There are some situations where you might not want to send an event to a specifi
464463
analytics.track('MyEvent', null, { integrations: { Mixpanel: false }})
465464
```
466465
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.
466+
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.
468467
469468
> 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 isn't clear.
469+
> **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.
471470
472471
## Identity and privacy
473472
@@ -487,7 +486,7 @@ If a user opts back in at a later date, you can re-enable data collection using
487486
analytics.enable()
488487
```
489488
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.
489+
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.
491490
492491
### Anonymizing IP
493492
@@ -524,7 +523,7 @@ React Native doesn't provide an official JavaScript API to handle push notificat
524523
525524
### React Native push notifications on iOS
526525
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.
526+
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.
528527
529528
```objc
530529
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

0 commit comments

Comments
 (0)