Skip to content

Post-Beta Release Fixes #157

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 3 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def defaultKotlinVersion = '1.3.21'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
def defaultKotlinVersion = '1.3.21'

repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", defaultKotlinVersion)}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : defaultKotlinVersion}"
}
}

Expand All @@ -37,10 +38,9 @@ repositories {
mavenCentral()
}


dependencies {
api 'com.segment.analytics.android:analytics:4.5.0-beta.0'

api 'com.facebook.react:react-native:+'
api "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet("kotlinVersion", defaultKotlinVersion)}"
api "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : defaultKotlinVersion}"
}
83 changes: 83 additions & 0 deletions packages/core/docs/classes/analytics.client.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@

*Defined in analytics.ts:96*

Whether the client is ready to send events to Segment.

This becomes `true` when `.setup()` succeeds. All calls will be queued until it becomes `true`.

___

## Methods
Expand All @@ -53,6 +57,10 @@ ___

*Defined in analytics.ts:266*

Merge two user identities, effectively connecting two sets of user data as one. This may not be supported by all integrations.

When you learn more about who the group is, you can record that information with group.

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -71,6 +79,10 @@ ___

*Defined in analytics.ts:111*

Catch React-Native bridge errors

These errors are emitted when calling the native counterpart. This only applies to methods with no return value (`Promise<void>`), methods like `getAnonymousId` do reject promises.

**Parameters:**

| Name | Type |
Expand All @@ -88,6 +100,10 @@ ___

*Defined in analytics.ts:305*

Completely disable the sending of any analytics data.

If you have a way for users to actively or passively (sometimes based on location) opt-out of analytics data collection, you can use this method to turn off all data collection.

**Returns:** `Promise`<`void`>

___
Expand All @@ -99,6 +115,10 @@ ___

*Defined in analytics.ts:295*

Enable the sending of analytics data. Enabled by default.

Occasionally used in conjunction with disable user opt-out handling.

**Returns:** `Promise`<`void`>

___
Expand All @@ -110,6 +130,10 @@ ___

*Defined in analytics.ts:286*

Trigger an upload of all queued events.

This is useful when you want to force all messages queued on the device to be uploaded. Please note that not all integrations respond to this method.

**Returns:** `Promise`<`void`>

___
Expand All @@ -121,6 +145,8 @@ ___

*Defined in analytics.ts:310*

Retrieve the anonymousId.

**Returns:** `Promise`<`string`>

___
Expand All @@ -132,6 +158,10 @@ ___

*Defined in analytics.ts:253*

Associate a user with a group, organization, company, project, or w/e _you_ call them.

When you learn more about who the group is, you can record that information with group.

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -151,6 +181,10 @@ ___

*Defined in analytics.ts:240*

Associate a user with their unique ID and record traits about them.

When you learn more about who your user is, you can record that information with identify.

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -170,6 +204,27 @@ ___

*Defined in analytics.ts:149*

Append a new middleware to the middleware chain.

Middlewares are a powerful mechanism that can augment the events collected by the SDK. A middleware is a simple function that is invoked by the Segment SDK and can be used to monitor, modify or reject events.

Middlewares are invoked for all events, including automatically tracked events, and external event sources like Adjust and Optimizely. This offers you the ability the customize those messages to fit your use case even if the event was sent outside your source code.

The key thing to observe here is that the output produced by the first middleware feeds into the second. This allows you to chain and compose independent middlewares!

For example, you might want to record the device year class with your events. Previously, you would have to do this everywhere you trigger an event with the Segment SDK. With middlewares, you can do this in a single place :

```js
import DeviceYearClass from 'react-native-device-year-class'

analytics.middleware(async ({next, context}) =>
next({
...context,
device_year_class: await DeviceYearClass()
})
)
```

**Parameters:**

| Name | Type | Description |
Expand All @@ -187,6 +242,10 @@ ___

*Defined in analytics.ts:276*

Reset any user state that is cached on the device.

This is useful when a user logs out and you want to clear the identity. It will clear any traits or userId's cached on the device.

**Returns:** `Promise`<`void`>

___
Expand All @@ -198,6 +257,10 @@ ___

*Defined in analytics.ts:225*

Record the screens or views your users see.

When a user views a screen in your app, you'll want to record that here. For some tools like Google Analytics and Flurry, screen views are treated specially, and are different from "events" kind of like "page views" on the web. For services that don't treat "screen views" specially, we map "screen" straight to "track" with the same parameters. For example, Mixpanel doesn't treat "screen views" any differently. So a call to "screen" will be tracked as a normal event in Mixpanel, but get sent to Google Analytics and Flurry as a "screen".

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -217,6 +280,18 @@ ___

*Defined in analytics.ts:188*

Setup the Analytics module. All calls made before are queued and only executed if the configuration was successful.

```js
await analytics.setup('YOUR_WRITE_KEY', {
using: [Mixpanel, GoogleAnalytics],
trackAppLifecycleEvents: true,
ios: {
trackDeepLinks: true
}
})
```

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -235,6 +310,10 @@ ___

*Defined in analytics.ts:207*

Record the actions your users perform.

When a user performs an action in your app, you'll want to track that action for later analysis. Use the event name to say what the user did, and properties to specify any interesting details of the action.

**Parameters:**

| Name | Type | Default value | Description |
Expand All @@ -254,6 +333,10 @@ ___

*Defined in analytics.ts:161*

Use the native configuration.

You'll need to call this method when you configure Analytics's singleton using the native API.

**Returns:** `this`

___
Expand Down
22 changes: 22 additions & 0 deletions packages/core/docs/interfaces/analytics.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

*Defined in analytics.ts:69*

Android specific settings.

___
<a id="debug"></a>

Expand All @@ -49,6 +51,10 @@ ___

*Defined in analytics.ts:46*

The number of queued events that the analytics client should flush at. Setting this to `1` will not queue any events and will use more battery.

`20` by default.

___
<a id="ios"></a>

Expand All @@ -58,6 +64,8 @@ ___

*Defined in analytics.ts:51*

iOS specific settings.

___
<a id="recordscreenviews"></a>

Expand All @@ -67,6 +75,10 @@ ___

*Defined in analytics.ts:19*

Whether the analytics client should automatically make a screen call when a view controller is added to a view hierarchy. Because the iOS underlying implementation uses method swizzling, we recommend initializing the analytics client as early as possible.

Disabled by default.

___
<a id="trackapplifecycleevents"></a>

Expand All @@ -76,6 +88,10 @@ ___

*Defined in analytics.ts:26*

Whether the analytics client should automatically track application lifecycle events, such as "Application Installed", "Application Updated" and "Application Opened".

Disabled by default.

___
<a id="trackattributiondata"></a>

Expand All @@ -85,6 +101,10 @@ ___

*Defined in analytics.ts:32*

Whether the analytics client should automatically track attribution data from enabled providers using the mobile service.

Disabled by default.

___
<a id="using"></a>

Expand All @@ -94,5 +114,7 @@ ___

*Defined in analytics.ts:37*

Register a set of integrations to be used with this Analytics instance.

___

2 changes: 1 addition & 1 deletion packages/integrations/src/gen-integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function prepareiOS({
const xcodeProject = 'ios/RNAnalyticsIntegration.xcodeproj'
const targetXcodeProject = `ios/${nativeModule}.xcodeproj`
const pod_name = `RNAnalyticsIntegration-${slug('-')}`
const framework_name = `Segment_${slug()}`
const framework_name = `Segment-${slug()}`
const {
pod: {
name: pod_dependency = `Segment-${slug()}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/template/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repositories {


dependencies {
api project(":@segment/analytics-react-native")
api project(":@segment_analytics-react-native")
api('{{{dependency}}}') {
transitive = true
}
Expand Down