Skip to content

Commit d0a0666

Browse files
stayseesongrchinn1
andauthored
Apply suggestions from code review
Co-authored-by: rchinn-segment <[email protected]>
1 parent 55ac361 commit d0a0666

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ 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

1313
> 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.
1515
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 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.
2020
>
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.
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

@@ -86,15 +86,15 @@ await analytics.setup('YOUR_WRITE_KEY', {
8686
})
8787
```
8888

89-
Next, 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.
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.
9090

9191
```js
9292
import analytics from '@segment/analytics-react-native'
9393
```
9494

9595
### Dynamic Framework for Manual Installation
9696

97-
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.
9898

9999
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.
100100

@@ -110,7 +110,7 @@ To install Analytics-React-native manually:
110110

111111
### Packaging Destinations using Device-mode
112112

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.
114114

115115
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.
116116

@@ -122,7 +122,7 @@ You can read [more about connection modes](/docs/connections/destinations/#conne
122122
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.
123123

124124
> 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.
126126
127127
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.
128128

@@ -133,7 +133,7 @@ yarn add @segment/analytics-react-native-{bugsnag,branch,firebase}
133133
```
134134

135135
> 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.
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.
137137
138138
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.
139139

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

189189
### Identify
190190

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.
192192

193193
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.
194194

@@ -197,7 +197,7 @@ Analytics-React-Native works on its own background thread, so it never blocks th
197197
> note ""
198198
> **Note**: Segment automatically assigns an `anonymousId` to users before you identify them. The `userId` is what connects anonymous activities across devices.
199199
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.
201201

202202
```js
203203
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
270270

271271
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.
272272

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.
274274

275275
The example Screen call below shows a user viewed the Photo Feed, and that the page was private.
276276

@@ -297,9 +297,9 @@ You can read more about the Screen call fields on [the Segment Spec page about t
297297

298298
### Group
299299

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.
301301

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.
303303

304304
The example Group call below adds the current user to the `myGroup` group, and adds a name and description.
305305

@@ -327,7 +327,7 @@ You can read more about the Group method, including the group call payload, in [
327327

328328
### Alias
329329

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.
331331

332332
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'.
333333

@@ -405,7 +405,7 @@ analytics.reset()
405405
406406
### Flush
407407

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.
409409

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

@@ -433,7 +433,7 @@ await analytics.setup('YOUR_WRITE_KEY', {
433433
})
434434
```
435435

436-
By default debug logging is disabled.
436+
By default, debug logging is disabled.
437437

438438

439439
### Application Lifecycle Tracking
@@ -448,7 +448,7 @@ await analytics.setup('YOUR_WRITE_KEY', {
448448

449449
### Adding data to the context
450450

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.
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.
452452

453453
```js
454454
analytics.identify('brandon', null, { context: { myValue: false, loginFailures: 3 }})
@@ -464,10 +464,10 @@ There are some situations where you might not want to send an event to a specifi
464464
analytics.track('MyEvent', null, { integrations: { Mixpanel: false }})
465465
```
466466

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 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.
468468

469469
> 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.
471471
472472
## Identity and privacy
473473

@@ -487,7 +487,7 @@ If a user opts back in at a later date, you can re-enable data collection using
487487
analytics.enable()
488488
```
489489

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.
491491

492492
### Anonymizing IP
493493

@@ -524,7 +524,7 @@ React Native doesn't provide an official JavaScript API to handle push notificat
524524

525525
### React Native push notifications on iOS
526526

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.
528528

529529
```objc
530530
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

0 commit comments

Comments
 (0)