-
Notifications
You must be signed in to change notification settings - Fork 197
Improve Readme #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Improve Readme #186
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ Analytics helps you measure your users, product, and business. It unlocks insigh | |
3. **Explore your data** by creating metrics (for example, new signups, retention cohorts, and revenue generation). | ||
- The best Segment companies use retention cohorts to measure product market fit. Netflix has 70% paid retention after 12 months, 30% after 7 years. | ||
|
||
[Segment](https://segment.com) collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one Segment code snippet, and you can turn integrations on and off at will, with no additional code. [Sign up with Segment today](https://app.segment.com/signup). | ||
[Segment](https://segment.com) collects analytics data and allows you to send it to more than 250 apps (such as Google Analytics, Mixpanel, Optimizely, Facebook Ads, Slack, Sentry) just by flipping a switch. You only need one Segment code snippet, and you can turn destinations on and off from the Segment web UI, with no additional code. [Sign up with Segment today](https://app.segment.com/signup). | ||
|
||
### Why? | ||
|
||
|
@@ -54,6 +54,10 @@ If you are part of a new startup (<$5M raised, <2 years since founding), | |
|
||
## Prerequisite | ||
|
||
#### React-Native | ||
|
||
- Version 0.62 or greater. | ||
|
||
#### iOS | ||
|
||
- CocoaPods (**recommended**) | ||
|
@@ -71,15 +75,17 @@ $ yarn react-native link | |
|
||
See the [API docs](packages/core/docs/classes/analytics.client.md) for more details. | ||
|
||
Additional examples of common usage patterns and how-to's can found at [Analytics for React-Native](https://segment.com/docs/connections/sources/catalog/libraries/mobile/react-native/). | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
import analytics from '@segment/analytics-react-native' | ||
import Mixpanel from '@segment/analytics-react-native-mixpanel' | ||
import GoogleAnalytics from '@segment/analytics-react-native-google-analytics' | ||
import mixpanel from '@segment/analytics-react-native-mixpanel' | ||
import firebase from '@segment/analytics-react-native-firebase' | ||
|
||
analytics | ||
.setup('writeKey', { | ||
using: [Mixpanel, GoogleAnalytics], | ||
using: [mixpanel, firebase], | ||
recordScreenViews: true, | ||
trackAppLifecycleEvents: true, | ||
trackAttributionData: true, | ||
|
@@ -111,22 +117,22 @@ analytics.screen('Home') | |
There are two ways to send data to your analytics services through this library: | ||
|
||
1. [Through the Segment servers](#cloud-based-connection-modes) | ||
2. [Directly from the device using bundled SDK’s](#packaging-device-based-destination-sdks) | ||
2. [Directly from the device using bundled SDK’s](#packaging-device-mode-destination-sdks) | ||
|
||
**Note**: Refer to the specific destination’s docs to see if your tool must be bundled in the app or sent server-side. | ||
|
||
#### Cloud-based Connection Modes | ||
|
||
When an destination’s SDK is not packaged, but it is enabled via your dashboard, the request goes through the Segment REST API, and is routed to the service’s server-side API as [described here](https://segment.com/docs/integrations/#connection-modes). | ||
When an destination’s SDK is not packaged, but it is enabled using the Segment web UI, the request goes through the Segment REST API, and is routed to the service’s server-side API as [described here](https://segment.com/docs/connections/destinations/#connection-modes). | ||
|
||
#### Packaging Device-based destination SDKs | ||
#### Packaging Device-mode Destination SDKs | ||
|
||
By default, our `@segment/analytics-react-native` package does not contain any device-based destinations. | ||
|
||
We recommend using device-based destinations on a need-to-use basis to reduce the size of your application, and avoid running into the dreaded 65k method limit on Android. | ||
We recommend only using device-based destinations on a need-to-use basis to reduce the size of your application, and to avoid running into the dreaded 65k method limit on Android. | ||
|
||
If you would like to package device-based destinations, first search for the dependency you need using [the list below](#integrations). | ||
You'll need to run `react-native link` and add it in the `.using()` configuration method. Example using Firebase : | ||
If you would like to package device-based destinations, first search for the dependency you need using [the list below](#supported-device-mode-destinations). | ||
Then run `react-native link` and add it in the `.using()` configuration method. Example using Firebase : | ||
|
||
```bash | ||
$ yarn add @segment/analytics-react-native-firebase | ||
|
@@ -143,14 +149,17 @@ await analytics.setup('writeKey', { | |
using: [firebase] | ||
}) | ||
``` | ||
For IOS you will need to add the GoogleService-info.plist to your IOS folder. This file can be downloaded from your Firebase instance. Firebase takes up to 24 hours to show events. However, you can utilize the Firebase debug method to confirm your setup is sending data correctly. To do this add ```-FIRDebugEnabled``` in Xcode’s Scheme Settings. | ||
|
||
In Xcode: | ||
```Project -> Scheme -> Edit Scheme -> Arguments Passed On Launch``` | ||
For IOS you must add the GoogleService-info.plist to your iOS folder. This file can be downloaded from your Firebase instance. Firebase takes up to 24 hours to show events. However, you can utilize the Firebase debug method to confirm your setup is sending data correctly. To do this add `-FIRDebugEnabled` in Xcode’s Scheme Settings. | ||
|
||
In Xcode: | ||
`Project -> Scheme -> Edit Scheme -> Arguments Passed On Launch` | ||
|
||
#### Supported Device-Mode Destinations | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
#### Integrations | ||
> All destinations have the same version as `@segment/analytics-react-native` | ||
|
||
> All integrations have the same version as `@segment/analytics-react-native` | ||
**Note**: Each device-mode destination has a different native setup procedure due to differences between the underlying SDK vendors. Please refer to the vendor documentation for configuring the native iOS and Android portions of a given destination. More information and links to vendor specific instructions and details can be found at [Connection Mode Comparisons](https://segment.com/docs/connections/destinations/cmodes-compare/). | ||
bsneed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<!-- AUTOGEN:INTEGRATIONS:BEGIN --> | ||
|
||
|
@@ -187,7 +196,7 @@ In Xcode: | |
|
||
We **highly recommend** using Cocoapods. | ||
|
||
However, if you cannot use Cocoapods, you can manually install our dynamic framework allowing you to send data to Segment and on to enabled cloud-mode destinations. We do not support sending data to bundled, device-mode integrations outside of Cocoapods. | ||
However, if you cannot use Cocoapods, you can manually install our dynamic framework allowing you to send data to Segment and on to enabled cloud-mode destinations. We do not support sending data to bundled, device-mode destinations outside of Cocoapods. | ||
|
||
Here are the steps for installing manually: | ||
|
||
|
@@ -209,7 +218,7 @@ If you're using Cocoapods, check that your `ios/Podfile` file contains the right | |
```ruby | ||
pod 'RNAnalytics', :path => '../node_modules/@segment/analytics-react-native' | ||
``` | ||
- `Failed to load [...] integration native module`, look for the integration native module, example with Google Analytics: | ||
- `Failed to load [...] integration native module`, look for the destination native module, example with Google Analytics: | ||
```ruby | ||
pod 'RNAnalyticsIntegration-Google-Analytics', :path => '../node_modules/@segment/analytics-react-native-google-analytics' | ||
``` | ||
|
@@ -239,7 +248,7 @@ Check that `android/app/src/main/.../MainApplication.java` contains a reference | |
} | ||
``` | ||
|
||
- `Failed to load [...] integration native module`, look for the integration native module, example with Google Analytics: | ||
- `Failed to load [...] integration native module`, look for the destination native module, example with Google Analytics: | ||
|
||
```java | ||
import com.segment.analytics.reactnative.integration.google.analytics.RNAnalyticsIntegration_Google_AnalyticsPackage; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.