Skip to content

Commit ad3aaac

Browse files
committed
Add screen tracking plugin and add support for browser plugins (snowplow#1394)
1 parent 164fc87 commit ad3aaac

33 files changed

Lines changed: 1506 additions & 41 deletions

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): Promise<ReactNativeTracker>;
12+
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration): 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) | 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 | Configuration for the tracker |
2020

2121
<b>Returns:</b>
2222

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ The ReactNativeTracker type
1010

1111
```typescript
1212
export declare type ReactNativeTracker = {
13+
namespace: string;
1314
readonly trackSelfDescribingEvent: <T extends Record<string, unknown> = Record<string, unknown>>(argmap: SelfDescribingJson<T>, contexts?: EventContext[]) => void;
15+
readonly trackScreenViewEvent: (argmap: ScreenViewProps, contexts?: EventContext[]) => void;
16+
readonly trackScrollChangedEvent: (argmap: ScrollChangedProps, contexts?: EventContext[]) => void;
17+
readonly trackListItemViewEvent: (argmap: ListItemViewProps, contexts?: EventContext[]) => void;
1418
readonly trackStructuredEvent: (argmap: StructuredEvent, contexts?: EventContext[]) => void;
1519
readonly trackPageViewEvent: (argmap: PageViewEvent, contexts?: EventContext[]) => void;
1620
readonly trackTimingEvent: (argmap: TimingProps, contexts?: EventContext[]) => void;
1721
readonly trackMessageNotificationEvent: (argmap: MessageNotificationProps, contexts?: EventContext[]) => void;
1822
addGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive> | Record<string, ConditionalContextProvider | ContextPrimitive>): void;
1923
clearGlobalContexts(): void;
2024
removeGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive | string>): void;
21-
addPlugin(configuration: CorePluginConfiguration): void;
25+
addPlugin(configuration: BrowserPluginConfiguration): void;
2226
flush: () => Promise<void>;
2327
readonly setAppId: (appId: string) => void;
2428
readonly setPlatform: (value: string) => void;
@@ -39,5 +43,5 @@ export declare type ReactNativeTracker = {
3943
readonly getSessionState: () => Promise<SessionState | undefined>;
4044
};
4145
```
42-
<b>References:</b> [EventContext](./react-native-tracker.eventcontext.md)<!-- -->, [TimingProps](./react-native-tracker.timingprops.md)<!-- -->, [MessageNotificationProps](./react-native-tracker.messagenotificationprops.md)<!-- -->, [ScreenSize](./react-native-tracker.screensize.md)<!-- -->, [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md)<!-- -->, [SessionState](./react-native-tracker.sessionstate.md)
46+
<b>References:</b> [EventContext](./react-native-tracker.eventcontext.md)<!-- -->, [ScreenViewProps](./react-native-tracker.screenviewprops.md)<!-- -->, [ScrollChangedProps](./react-native-tracker.scrollchangedprops.md)<!-- -->, [ListItemViewProps](./react-native-tracker.listitemviewprops.md)<!-- -->, [TimingProps](./react-native-tracker.timingprops.md)<!-- -->, [MessageNotificationProps](./react-native-tracker.messagenotificationprops.md)<!-- -->, [ScreenSize](./react-native-tracker.screensize.md)<!-- -->, [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md)<!-- -->, [SessionState](./react-native-tracker.sessionstate.md)
4347

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ export interface TrackerConfiguration
1919
| [appId?](./react-native-tracker.trackerconfiguration.appid.md) | string | <i>(Optional)</i> The application ID |
2020
| [encodeBase64?](./react-native-tracker.trackerconfiguration.encodebase64.md) | boolean | <i>(Optional)</i> Whether unstructured events and custom contexts should be base64 encoded. |
2121
| [namespace](./react-native-tracker.trackerconfiguration.namespace.md) | string | The namespace of the tracker |
22+
| [plugins?](./react-native-tracker.trackerconfiguration.plugins.md) | BrowserPlugin\[\] | <i>(Optional)</i> Inject plugins which will be evaluated for each event |
2223

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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; [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &gt; [plugins](./react-native-tracker.trackerconfiguration.plugins.md)
4+
5+
## TrackerConfiguration.plugins property
6+
7+
Inject plugins which will be evaluated for each event
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
plugins?: BrowserPlugin[];
13+
```

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
55
```ts
66

7+
import { BrowserPlugin } from '@snowplow/browser-tracker-core';
8+
import { BrowserPluginConfiguration } from '@snowplow/browser-tracker-core';
9+
import { ScreenTrackingConfiguration } from '@snowplow/browser-plugin-screen-tracking';
10+
711
// @public
812
export type ConditionalContextProvider = FilterProvider | RuleSetProvider;
913

@@ -251,7 +255,7 @@ export type MessageNotificationProps = {
251255
};
252256

253257
// @public
254-
export function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration): Promise<ReactNativeTracker>;
258+
export function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & ScreenTrackingConfiguration): Promise<ReactNativeTracker>;
255259

256260
// @public
257261
export interface PageViewEvent {
@@ -277,15 +281,19 @@ export interface PayloadBuilder {
277281

278282
// @public
279283
export type ReactNativeTracker = {
284+
namespace: string;
280285
readonly trackSelfDescribingEvent: <T extends Record<string, unknown> = Record<string, unknown>>(argmap: SelfDescribingJson<T>, contexts?: EventContext[]) => void;
286+
readonly trackScreenViewEvent: (argmap: ScreenViewProps, contexts?: EventContext[]) => void;
287+
readonly trackScrollChangedEvent: (argmap: ScrollChangedProps, contexts?: EventContext[]) => void;
288+
readonly trackListItemViewEvent: (argmap: ListItemViewProps, contexts?: EventContext[]) => void;
281289
readonly trackStructuredEvent: (argmap: StructuredEvent, contexts?: EventContext[]) => void;
282290
readonly trackPageViewEvent: (argmap: PageViewEvent, contexts?: EventContext[]) => void;
283291
readonly trackTimingEvent: (argmap: TimingProps, contexts?: EventContext[]) => void;
284292
readonly trackMessageNotificationEvent: (argmap: MessageNotificationProps, contexts?: EventContext[]) => void;
285293
addGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive> | Record<string, ConditionalContextProvider | ContextPrimitive>): void;
286294
clearGlobalContexts(): void;
287295
removeGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive | string>): void;
288-
addPlugin(configuration: CorePluginConfiguration): void;
296+
addPlugin(configuration: BrowserPluginConfiguration): void;
289297
flush: () => Promise<void>;
290298
readonly setAppId: (appId: string) => void;
291299
readonly setPlatform: (value: string) => void;
@@ -426,6 +434,7 @@ export interface TrackerConfiguration {
426434
appId?: string;
427435
encodeBase64?: boolean;
428436
namespace: string;
437+
plugins?: BrowserPlugin[];
429438
}
430439

431440
// @public
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/browser-plugin-screen-tracking",
5+
"comment": "Add screen tracking plugin and add support for browser plugins (#1394)",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@snowplow/browser-plugin-screen-tracking"
10+
}
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 screen tracking plugin and add support for browser plugins (#1394)",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@snowplow/react-native-tracker"
10+
}

common/config/rush/browser-approved-packages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126
"name": "@snowplow/browser-plugin-privacy-sandbox",
127127
"allowedCategories": [ "trackers" ]
128128
},
129+
{
130+
"name": "@snowplow/browser-plugin-screen-tracking",
131+
"allowedCategories": [ "trackers" ]
132+
},
129133
{
130134
"name": "@snowplow/browser-plugin-site-tracking",
131135
"allowedCategories": [ "trackers" ]

common/config/rush/pnpm-lock.yaml

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/config/rush/repo-state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "50fa04b4f2a1f9fdbf83a84ce901759859832bfd",
3+
"pnpmShrinkwrapHash": "d1933251824ef3eb837586f089856ce0f6036111",
44
"preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
55
}

0 commit comments

Comments
 (0)