Skip to content

Commit 38bc5af

Browse files
committed
Add app install, foreground and background event and application entity tracking (snowplow#1396)
1 parent 33ef906 commit 38bc5af

20 files changed

+648
-27
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) &gt; [appBuild](./react-native-tracker.applifecycleconfiguration.appbuild.md)
4+
5+
## AppLifecycleConfiguration.appBuild property
6+
7+
Build name of the application e.g s9f2k2d or 1.1.0 beta
8+
9+
Entity schema: `iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0`
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
appBuild?: string;
15+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) &gt; [appVersion](./react-native-tracker.applifecycleconfiguration.appversion.md)
4+
5+
## AppLifecycleConfiguration.appVersion property
6+
7+
Version number of the application e.g 1.1.0 (semver or git commit hash).
8+
9+
Entity schema if `appBuild` property is set: `iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0` Entity schema if `appBuild` property is not set: `iglu:com.snowplowanalytics.snowplow/application/jsonschema/1-0-0`
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
appVersion?: string;
15+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) &gt; [installAutotracking](./react-native-tracker.applifecycleconfiguration.installautotracking.md)
4+
5+
## AppLifecycleConfiguration.installAutotracking property
6+
7+
Whether to automatically track app install event on first run.
8+
9+
Schema: `iglu:com.snowplowanalytics.mobile/application_install/jsonschema/1-0-0`
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
installAutotracking?: boolean;
15+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) &gt; [lifecycleAutotracking](./react-native-tracker.applifecycleconfiguration.lifecycleautotracking.md)
4+
5+
## AppLifecycleConfiguration.lifecycleAutotracking property
6+
7+
Whether to automatically track app lifecycle events (app foreground and background events). Also adds a lifecycle context entity to all events.
8+
9+
Foreground event schema: `iglu:com.snowplowanalytics.snowplow/application_foreground/jsonschema/1-0-0` Background event schema: `iglu:com.snowplowanalytics.snowplow/application_background/jsonschema/1-0-0` Context entity schema: `iglu:com.snowplowanalytics.mobile/application_lifecycle/jsonschema/1-0-0`
10+
11+
<b>Signature:</b>
12+
13+
```typescript
14+
lifecycleAutotracking?: boolean;
15+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md)
4+
5+
## AppLifecycleConfiguration interface
6+
7+
Configuration for app lifecycle tracking
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export interface AppLifecycleConfiguration
13+
```
14+
15+
## Properties
16+
17+
| Property | Type | Description |
18+
| --- | --- | --- |
19+
| [appBuild?](./react-native-tracker.applifecycleconfiguration.appbuild.md) | string | <i>(Optional)</i> Build name of the application e.g s9f2k2d or 1.1.0 beta<!-- -->Entity schema: <code>iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0</code> |
20+
| [appVersion?](./react-native-tracker.applifecycleconfiguration.appversion.md) | string | <i>(Optional)</i> Version number of the application e.g 1.1.0 (semver or git commit hash).<!-- -->Entity schema if <code>appBuild</code> property is set: <code>iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0</code> Entity schema if <code>appBuild</code> property is not set: <code>iglu:com.snowplowanalytics.snowplow/application/jsonschema/1-0-0</code> |
21+
| [installAutotracking?](./react-native-tracker.applifecycleconfiguration.installautotracking.md) | boolean | <i>(Optional)</i> Whether to automatically track app install event on first run.<!-- -->Schema: <code>iglu:com.snowplowanalytics.mobile/application_install/jsonschema/1-0-0</code> |
22+
| [lifecycleAutotracking?](./react-native-tracker.applifecycleconfiguration.lifecycleautotracking.md) | boolean | <i>(Optional)</i> Whether to automatically track app lifecycle events (app foreground and background events). Also adds a lifecycle context entity to all events.<!-- -->Foreground event schema: <code>iglu:com.snowplowanalytics.snowplow/application_foreground/jsonschema/1-0-0</code> Background event schema: <code>iglu:com.snowplowanalytics.snowplow/application_background/jsonschema/1-0-0</code> Context entity schema: <code>iglu:com.snowplowanalytics.mobile/application_lifecycle/jsonschema/1-0-0</code> |
23+

api-docs/docs/react-native-tracker/markdown/react-native-tracker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
| Interface | Description |
2626
| --- | --- |
27+
| [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) | Configuration for app lifecycle tracking |
2728
| [CoreConfiguration](./react-native-tracker.coreconfiguration.md) | The configuration object for the tracker core library |
2829
| [CorePlugin](./react-native-tracker.coreplugin.md) | Interface which defines Core Plugins |
2930
| [CorePluginConfiguration](./react-native-tracker.corepluginconfiguration.md) | The configuration of the plugin to add |

api-docs/docs/react-native-tracker/markdown/react-native-tracker.newtracker.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Creates a new tracker instance with the given configuration
99
<b>Signature:</b>
1010

1111
```typescript
12-
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration): Promise<ReactNativeTracker>;
12+
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration & AppLifecycleConfiguration): Promise<ReactNativeTracker>;
1313
```
1414

1515
## Parameters
1616

1717
| Parameter | Type | Description |
1818
| --- | --- | --- |
19-
| configuration | [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &amp; EmitterConfiguration &amp; [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) &amp; [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md) &amp; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) &amp; ScreenTrackingConfiguration &amp; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &amp; [DeepLinkConfiguration](./react-native-tracker.deeplinkconfiguration.md) | Configuration for the tracker |
19+
| configuration | [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &amp; EmitterConfiguration &amp; [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) &amp; [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md) &amp; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) &amp; ScreenTrackingConfiguration &amp; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &amp; [DeepLinkConfiguration](./react-native-tracker.deeplinkconfiguration.md) &amp; [AppLifecycleConfiguration](./react-native-tracker.applifecycleconfiguration.md) | Configuration for the tracker |
2020

2121
<b>Returns:</b>
2222

api-docs/docs/react-native-tracker/markdown/react-native-tracker.reactnativetracker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export declare type ReactNativeTracker = {
4242
readonly getSessionId: () => Promise<string | undefined>;
4343
readonly getSessionIndex: () => Promise<number | undefined>;
4444
readonly getSessionState: () => Promise<SessionState | undefined>;
45+
readonly getIsInBackground: () => boolean | undefined;
46+
readonly getBackgroundIndex: () => number | undefined;
47+
readonly getForegroundIndex: () => number | undefined;
4548
readonly enablePlatformContext: () => Promise<void>;
4649
readonly disablePlatformContext: () => void;
4750
readonly refreshPlatformContext: () => Promise<void>;

api-docs/docs/react-native-tracker/react-native-tracker.api.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import { BrowserPlugin } from '@snowplow/browser-tracker-core';
88
import { BrowserPluginConfiguration } from '@snowplow/browser-tracker-core';
99
import { ScreenTrackingConfiguration } from '@snowplow/browser-plugin-screen-tracking';
1010

11+
// @public
12+
export interface AppLifecycleConfiguration {
13+
appBuild?: string;
14+
appVersion?: string;
15+
installAutotracking?: boolean;
16+
lifecycleAutotracking?: boolean;
17+
}
18+
1119
// @public
1220
export type ConditionalContextProvider = FilterProvider | RuleSetProvider;
1321

@@ -260,7 +268,7 @@ export type MessageNotificationProps = {
260268
};
261269

262270
// @public
263-
export function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration): Promise<ReactNativeTracker>;
271+
export function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration & PlatformContextConfiguration & DeepLinkConfiguration & AppLifecycleConfiguration): Promise<ReactNativeTracker>;
264272

265273
// @public
266274
export interface PageViewEvent {
@@ -377,6 +385,9 @@ export type ReactNativeTracker = {
377385
readonly getSessionId: () => Promise<string | undefined>;
378386
readonly getSessionIndex: () => Promise<number | undefined>;
379387
readonly getSessionState: () => Promise<SessionState | undefined>;
388+
readonly getIsInBackground: () => boolean | undefined;
389+
readonly getBackgroundIndex: () => number | undefined;
390+
readonly getForegroundIndex: () => number | undefined;
380391
readonly enablePlatformContext: () => Promise<void>;
381392
readonly disablePlatformContext: () => void;
382393
readonly refreshPlatformContext: () => Promise<void>;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@snowplow/react-native-tracker",
5+
"comment": "Add app install, foreground and background event and application entity tracking (#1396)",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@snowplow/react-native-tracker"
10+
}

0 commit comments

Comments
 (0)