@snowplow/react-native-tracker 2.1.2 → 4.0.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -203
- package/README.md +59 -143
- package/dist/commonjs/event_store.js +150 -0
- package/dist/commonjs/event_store.js.map +1 -0
- package/dist/commonjs/events.js +42 -0
- package/dist/commonjs/events.js.map +1 -0
- package/dist/commonjs/index.js +29 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/subject.js +82 -0
- package/dist/commonjs/subject.js.map +1 -0
- package/dist/commonjs/tracker.js +77 -0
- package/dist/commonjs/tracker.js.map +1 -0
- package/dist/commonjs/types.js +223 -0
- package/dist/commonjs/types.js.map +1 -0
- package/dist/module/event_store.js +145 -0
- package/dist/module/event_store.js.map +1 -0
- package/dist/module/events.js +38 -0
- package/dist/module/events.js.map +1 -0
- package/dist/module/index.js +7 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/subject.js +78 -0
- package/dist/module/subject.js.map +1 -0
- package/dist/module/tracker.js +74 -0
- package/dist/module/tracker.js.map +1 -0
- package/dist/module/types.js +73 -0
- package/dist/module/types.js.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/src/event_store.d.ts +4 -0
- package/dist/typescript/commonjs/src/event_store.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/events.d.ts +10 -0
- package/dist/typescript/commonjs/src/events.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/subject.d.ts +19 -0
- package/dist/typescript/commonjs/src/subject.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/tracker.d.ts +9 -0
- package/dist/typescript/commonjs/src/tracker.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/types.d.ts +452 -0
- package/dist/typescript/commonjs/src/types.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/src/event_store.d.ts +4 -0
- package/dist/typescript/module/src/event_store.d.ts.map +1 -0
- package/dist/typescript/module/src/events.d.ts +10 -0
- package/dist/typescript/module/src/events.d.ts.map +1 -0
- package/dist/typescript/module/src/index.d.ts +4 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -0
- package/dist/typescript/module/src/subject.d.ts +19 -0
- package/dist/typescript/module/src/subject.d.ts.map +1 -0
- package/dist/typescript/module/src/tracker.d.ts +9 -0
- package/dist/typescript/module/src/tracker.d.ts.map +1 -0
- package/dist/typescript/module/src/types.d.ts +452 -0
- package/dist/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +75 -147
- package/.editorconfig +0 -15
- package/.eslintignore +0 -6
- package/.gitattributes +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/actions/setup/action.yml +0 -28
- package/.github/workflows/build.yml +0 -155
- package/.github/workflows/deploy.yml +0 -97
- package/.github/workflows/e2e-android.yml +0 -121
- package/.github/workflows/e2e-ios.yml +0 -95
- package/.github/workflows/snyk.yml +0 -21
- package/.gitignore +0 -70
- package/.npmignore +0 -60
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarnrc +0 -3
- package/CHANGELOG +0 -184
- package/CONTRIBUTING.md +0 -80
- package/android/build.gradle +0 -110
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradle.properties +0 -5
- package/android/gradlew +0 -234
- package/android/gradlew.bat +0 -89
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +0 -744
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +0 -17
- package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +0 -274
- package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +0 -233
- package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +0 -5
- package/babel.config.js +0 -3
- package/example/.watchmanconfig +0 -1
- package/example/Gemfile +0 -6
- package/example/android/app/build.gradle +0 -129
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +0 -10
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +0 -36
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +0 -21
- package/example/android/app/src/debug/AndroidManifest.xml +0 -13
- package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/AndroidManifest.xml +0 -26
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +0 -32
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +0 -62
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +0 -3
- package/example/android/app/src/main/res/values/styles.xml +0 -9
- package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -20
- package/example/android/build.gradle +0 -31
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/example/android/gradle.properties +0 -44
- package/example/android/gradlew +0 -244
- package/example/android/gradlew.bat +0 -92
- package/example/android/settings.gradle +0 -4
- package/example/app.json +0 -4
- package/example/babel.config.js +0 -17
- package/example/detox.config.js +0 -92
- package/example/e2e/config.json +0 -10
- package/example/e2e/emitEvents.e2e.detox.js +0 -95
- package/example/e2e/environment.js +0 -23
- package/example/e2e/helpers/microCommands.js +0 -140
- package/example/e2e/helpers/microHelpers.js +0 -333
- package/example/e2e/helpers/microHelpers.test.js +0 -295
- package/example/e2e/helpers/schemas.js +0 -49
- package/example/e2e/jest.config.js +0 -16
- package/example/e2e/setup.js +0 -4
- package/example/e2e/testEvents.micro.test.js +0 -287
- package/example/index.js +0 -5
- package/example/ios/.xcode.env +0 -11
- package/example/ios/Podfile +0 -62
- package/example/ios/Podfile.lock +0 -730
- package/example/ios/ReactNativeTrackerExample/AppDelegate.h +0 -6
- package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +0 -26
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +0 -6
- package/example/ios/ReactNativeTrackerExample/Info.plist +0 -55
- package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +0 -47
- package/example/ios/ReactNativeTrackerExample/PrivacyInfo.xcprivacy +0 -37
- package/example/ios/ReactNativeTrackerExample/main.m +0 -10
- package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +0 -3
- package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +0 -739
- package/example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme +0 -88
- package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/ReactNativeTrackerExampleTests/Info.plist +0 -24
- package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +0 -66
- package/example/metro.config.js +0 -45
- package/example/package.json +0 -54
- package/example/react-native.config.js +0 -10
- package/example/src/App.js +0 -566
- package/example/tsconfig.json +0 -5
- package/example/yarn.lock +0 -7703
- package/ios/ReactNativeTracker-Bridging-Header.h +0 -2
- package/ios/ReactNativeTracker.mm +0 -171
- package/ios/ReactNativeTracker.swift +0 -822
- package/ios/ReactNativeTracker.xcodeproj/project.pbxproj +0 -301
- package/ios/Util/ConfigUtils.swift +0 -209
- package/ios/Util/TrackerVersion.swift +0 -3
- package/ios/Util/Utilities.swift +0 -37
- package/lefthook.yml +0 -11
- package/lib/commonjs/api.js +0 -490
- package/lib/commonjs/api.js.map +0 -1
- package/lib/commonjs/configurations.js +0 -196
- package/lib/commonjs/configurations.js.map +0 -1
- package/lib/commonjs/constants.js +0 -77
- package/lib/commonjs/constants.js.map +0 -1
- package/lib/commonjs/events.js +0 -277
- package/lib/commonjs/events.js.map +0 -1
- package/lib/commonjs/index.js +0 -132
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/jsCore.js +0 -427
- package/lib/commonjs/jsCore.js.map +0 -1
- package/lib/commonjs/native.js +0 -16
- package/lib/commonjs/native.js.map +0 -1
- package/lib/commonjs/subject.js +0 -235
- package/lib/commonjs/subject.js.map +0 -1
- package/lib/commonjs/tracker.js +0 -248
- package/lib/commonjs/tracker.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils.js +0 -72
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/commonjs/webViewInterface.js +0 -66
- package/lib/commonjs/webViewInterface.js.map +0 -1
- package/lib/module/api.js +0 -452
- package/lib/module/api.js.map +0 -1
- package/lib/module/configurations.js +0 -184
- package/lib/module/configurations.js.map +0 -1
- package/lib/module/constants.js +0 -72
- package/lib/module/constants.js.map +0 -1
- package/lib/module/events.js +0 -259
- package/lib/module/events.js.map +0 -1
- package/lib/module/index.js +0 -120
- package/lib/module/index.js.map +0 -1
- package/lib/module/jsCore.js +0 -424
- package/lib/module/jsCore.js.map +0 -1
- package/lib/module/native.js +0 -12
- package/lib/module/native.js.map +0 -1
- package/lib/module/subject.js +0 -222
- package/lib/module/subject.js.map +0 -1
- package/lib/module/tracker.js +0 -234
- package/lib/module/tracker.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils.js +0 -66
- package/lib/module/utils.js.map +0 -1
- package/lib/module/webViewInterface.js +0 -62
- package/lib/module/webViewInterface.js.map +0 -1
- package/lib/typescript/__tests__/api.test.d.ts +0 -2
- package/lib/typescript/__tests__/api.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/configurations.test.d.ts +0 -2
- package/lib/typescript/__tests__/configurations.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/events.test.d.ts +0 -2
- package/lib/typescript/__tests__/events.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/index.test.d.ts +0 -2
- package/lib/typescript/__tests__/index.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/jsCore.test.d.ts +0 -2
- package/lib/typescript/__tests__/jsCore.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/utils.test.d.ts +0 -2
- package/lib/typescript/__tests__/utils.test.d.ts.map +0 -1
- package/lib/typescript/api.d.ts +0 -240
- package/lib/typescript/api.d.ts.map +0 -1
- package/lib/typescript/configurations.d.ts +0 -73
- package/lib/typescript/configurations.d.ts.map +0 -1
- package/lib/typescript/constants.d.ts +0 -64
- package/lib/typescript/constants.d.ts.map +0 -1
- package/lib/typescript/events.d.ts +0 -115
- package/lib/typescript/events.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -27
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/jsCore.d.ts +0 -152
- package/lib/typescript/jsCore.d.ts.map +0 -1
- package/lib/typescript/native.d.ts +0 -4
- package/lib/typescript/native.d.ts.map +0 -1
- package/lib/typescript/subject.d.ts +0 -91
- package/lib/typescript/subject.d.ts.map +0 -1
- package/lib/typescript/tracker.d.ts +0 -111
- package/lib/typescript/tracker.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -981
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils.d.ts +0 -35
- package/lib/typescript/utils.d.ts.map +0 -1
- package/lib/typescript/webViewInterface.d.ts +0 -15
- package/lib/typescript/webViewInterface.d.ts.map +0 -1
- package/scripts/bootstrap.js +0 -29
- package/snowplow-react-native-tracker.podspec +0 -42
- package/src/__mocks__/react-native.js +0 -7
- package/src/__tests__/api.test.ts +0 -21
- package/src/__tests__/configurations.test.ts +0 -608
- package/src/__tests__/events.test.ts +0 -736
- package/src/__tests__/index.test.ts +0 -14
- package/src/__tests__/jsCore.test.ts +0 -199
- package/src/__tests__/utils.test.ts +0 -10
- package/src/api.ts +0 -556
- package/src/configurations.ts +0 -325
- package/src/constants.ts +0 -97
- package/src/events.ts +0 -355
- package/src/index.ts +0 -184
- package/src/jsCore.ts +0 -603
- package/src/native.ts +0 -21
- package/src/subject.ts +0 -302
- package/src/tracker.ts +0 -377
- package/src/types.ts +0 -1162
- package/src/utils.ts +0 -65
- package/src/webViewInterface.ts +0 -92
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -28
- package/turbo.json +0 -34
- package/yarn.lock +0 -9398
package/example/src/App.js
DELETED
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sample React Native App
|
|
3
|
-
* https://github.com/facebook/react-native
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
* @flow strict-local
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import {
|
|
11
|
-
SafeAreaView,
|
|
12
|
-
ScrollView,
|
|
13
|
-
StatusBar,
|
|
14
|
-
StyleSheet,
|
|
15
|
-
Text,
|
|
16
|
-
useColorScheme,
|
|
17
|
-
View,
|
|
18
|
-
Button,
|
|
19
|
-
Dimensions,
|
|
20
|
-
} from 'react-native';
|
|
21
|
-
import { WebView } from 'react-native-webview';
|
|
22
|
-
|
|
23
|
-
import { Colors, Header } from 'react-native/Libraries/NewAppScreen';
|
|
24
|
-
|
|
25
|
-
import {
|
|
26
|
-
createTracker,
|
|
27
|
-
removeTracker,
|
|
28
|
-
getWebViewCallback,
|
|
29
|
-
} from '@snowplow/react-native-tracker';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* URI of the Snowplow collector (e.g., Micro, Mini, or BDP) to send events to
|
|
33
|
-
*/
|
|
34
|
-
const collectorEndpoint = 'placeholder';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* URI of a website to load in the webview component
|
|
38
|
-
*/
|
|
39
|
-
const webViewEndpoint = '';
|
|
40
|
-
|
|
41
|
-
const Section = ({ children, title }) => {
|
|
42
|
-
const isDarkMode = useColorScheme() === 'dark';
|
|
43
|
-
return (
|
|
44
|
-
<View style={styles.sectionContainer}>
|
|
45
|
-
<Text
|
|
46
|
-
style={[
|
|
47
|
-
styles.sectionTitle,
|
|
48
|
-
{
|
|
49
|
-
color: isDarkMode ? Colors.white : Colors.black,
|
|
50
|
-
},
|
|
51
|
-
]}
|
|
52
|
-
>
|
|
53
|
-
{title}
|
|
54
|
-
</Text>
|
|
55
|
-
<Text
|
|
56
|
-
style={[
|
|
57
|
-
styles.sectionDescription,
|
|
58
|
-
{
|
|
59
|
-
color: isDarkMode ? Colors.light : Colors.dark,
|
|
60
|
-
},
|
|
61
|
-
]}
|
|
62
|
-
>
|
|
63
|
-
{children}
|
|
64
|
-
</Text>
|
|
65
|
-
</View>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const App = () => {
|
|
70
|
-
const isDarkMode = useColorScheme() === 'dark';
|
|
71
|
-
|
|
72
|
-
const backgroundStyle = {
|
|
73
|
-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const tracker = createTracker(
|
|
77
|
-
'sp1',
|
|
78
|
-
{
|
|
79
|
-
endpoint: collectorEndpoint,
|
|
80
|
-
requestHeaders: {
|
|
81
|
-
test: 'works',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
trackerConfig: {
|
|
86
|
-
appId: 'DemoAppId',
|
|
87
|
-
base64Encoding: false,
|
|
88
|
-
devicePlatform: 'iot',
|
|
89
|
-
installAutotracking: false,
|
|
90
|
-
},
|
|
91
|
-
sessionConfig: {
|
|
92
|
-
foregroundTimeout: 5,
|
|
93
|
-
backgroundTimeout: 10,
|
|
94
|
-
},
|
|
95
|
-
subjectConfig: {
|
|
96
|
-
userId: 'tester',
|
|
97
|
-
screenViewport: [200, 200],
|
|
98
|
-
language: 'fr',
|
|
99
|
-
},
|
|
100
|
-
gdprConfig: {
|
|
101
|
-
basisForProcessing: 'consent',
|
|
102
|
-
documentId: 'docId',
|
|
103
|
-
documentVersion: '0.0.1',
|
|
104
|
-
documentDescription: 'test gdpr document',
|
|
105
|
-
},
|
|
106
|
-
gcConfig: [
|
|
107
|
-
{
|
|
108
|
-
tag: 'testTag',
|
|
109
|
-
globalContexts: [
|
|
110
|
-
{
|
|
111
|
-
schema:
|
|
112
|
-
'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0',
|
|
113
|
-
data: { impressionId: 'test_global_contexts_0' },
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
schema:
|
|
117
|
-
'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0',
|
|
118
|
-
data: { impressionId: 'test_global_contexts_1' },
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
const secTracker = createTracker(
|
|
127
|
-
'sp2',
|
|
128
|
-
{
|
|
129
|
-
endpoint: collectorEndpoint,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
trackerConfig: {
|
|
133
|
-
screenViewAutotracking: false, // for tests predictability
|
|
134
|
-
installAutotracking: false,
|
|
135
|
-
},
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
const anonymousTracker = createTracker(
|
|
140
|
-
'sp_anon',
|
|
141
|
-
{
|
|
142
|
-
endpoint: collectorEndpoint,
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
trackerConfig: {
|
|
146
|
-
screenViewAutotracking: false, // for tests predictability
|
|
147
|
-
installAutotracking: false,
|
|
148
|
-
userAnonymisation: true,
|
|
149
|
-
},
|
|
150
|
-
emitterConfig: {
|
|
151
|
-
serverAnonymisation: true,
|
|
152
|
-
},
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
const onPressTrackScreenViewEvent = () => {
|
|
157
|
-
tracker.trackScreenViewEvent({ name: 'onlyRequired' });
|
|
158
|
-
tracker.trackScrollChangedEvent({
|
|
159
|
-
yOffset: 20,
|
|
160
|
-
contentHeight: 100,
|
|
161
|
-
viewHeight: 50,
|
|
162
|
-
});
|
|
163
|
-
tracker.trackListItemViewEvent({
|
|
164
|
-
index: 1,
|
|
165
|
-
itemsCount: 10,
|
|
166
|
-
});
|
|
167
|
-
tracker.trackScreenViewEvent({
|
|
168
|
-
name: 'allPopulated',
|
|
169
|
-
type: 'allPopulated',
|
|
170
|
-
transitionType: 'test',
|
|
171
|
-
});
|
|
172
|
-
tracker.trackScreenViewEvent({
|
|
173
|
-
name: 'allOptionalsNull',
|
|
174
|
-
type: null,
|
|
175
|
-
transitionType: null,
|
|
176
|
-
});
|
|
177
|
-
tracker.trackScreenViewEvent({
|
|
178
|
-
name: 'allOptionalsUndefined',
|
|
179
|
-
type: undefined,
|
|
180
|
-
transitionType: undefined,
|
|
181
|
-
});
|
|
182
|
-
tracker.trackScreenViewEvent(
|
|
183
|
-
{
|
|
184
|
-
name: 'withContext and screenId',
|
|
185
|
-
id: '5d79770b-015b-4af8-8c91-b2ed6faf4b1e',
|
|
186
|
-
},
|
|
187
|
-
[
|
|
188
|
-
{
|
|
189
|
-
schema:
|
|
190
|
-
'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0',
|
|
191
|
-
data: { impressionId: 'test_imp_id' },
|
|
192
|
-
},
|
|
193
|
-
]
|
|
194
|
-
);
|
|
195
|
-
tracker.trackScreenViewEvent({ name: 'withEmptyArrayContext' }, []);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const onPressTrackSelfDescribingEvent = () => {
|
|
199
|
-
tracker.trackSelfDescribingEvent({
|
|
200
|
-
schema: 'iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1',
|
|
201
|
-
data: { targetUrl: 'test.test' },
|
|
202
|
-
});
|
|
203
|
-
tracker.trackTimingEvent({
|
|
204
|
-
category: 'testTimingCategory',
|
|
205
|
-
variable: 'testTimingVariable',
|
|
206
|
-
timing: 10,
|
|
207
|
-
});
|
|
208
|
-
tracker.trackConsentGrantedEvent({
|
|
209
|
-
expiry: '2022-01-01T00:00:00Z',
|
|
210
|
-
documentId: '0123',
|
|
211
|
-
version: '0.1.0',
|
|
212
|
-
});
|
|
213
|
-
tracker.trackConsentWithdrawnEvent({
|
|
214
|
-
all: true,
|
|
215
|
-
documentId: '0987',
|
|
216
|
-
version: '0.2.0',
|
|
217
|
-
});
|
|
218
|
-
tracker.trackEcommerceTransactionEvent(
|
|
219
|
-
{
|
|
220
|
-
orderId: '0000',
|
|
221
|
-
totalValue: 10,
|
|
222
|
-
items: [
|
|
223
|
-
{
|
|
224
|
-
sku: '123',
|
|
225
|
-
price: 5,
|
|
226
|
-
quantity: 2,
|
|
227
|
-
},
|
|
228
|
-
],
|
|
229
|
-
},
|
|
230
|
-
[]
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
const onPressTrackStructuredEvent = () => {
|
|
235
|
-
tracker.trackStructuredEvent({
|
|
236
|
-
category: 'SeTest',
|
|
237
|
-
action: 'allPopulated',
|
|
238
|
-
label: 'valueIsFloat',
|
|
239
|
-
property: 'property',
|
|
240
|
-
value: 50.1,
|
|
241
|
-
});
|
|
242
|
-
tracker.trackStructuredEvent({
|
|
243
|
-
category: 'SeTest',
|
|
244
|
-
action: 'allPopulated',
|
|
245
|
-
label: 'valueIsNullAndSoIsProperty',
|
|
246
|
-
property: null,
|
|
247
|
-
value: null,
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
tracker.trackStructuredEvent({
|
|
251
|
-
category: 'SeTest',
|
|
252
|
-
action: 'allPopulated',
|
|
253
|
-
label: 'valueIsUndefined',
|
|
254
|
-
property: 'property',
|
|
255
|
-
value: undefined,
|
|
256
|
-
});
|
|
257
|
-
tracker.trackStructuredEvent({
|
|
258
|
-
category: 'SeTest',
|
|
259
|
-
action: 'onlyRequired',
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
const onPressTrackPageViewEvent = () => {
|
|
264
|
-
tracker.trackPageViewEvent({
|
|
265
|
-
pageUrl: 'https://allpopulated.com',
|
|
266
|
-
pageTitle: 'some title',
|
|
267
|
-
referrer: 'http://refr.com',
|
|
268
|
-
});
|
|
269
|
-
tracker.trackPageViewEvent({ pageUrl: 'https://onlyrequired.com' });
|
|
270
|
-
tracker.trackPageViewEvent({
|
|
271
|
-
pageUrl: 'https://alloptionalsnull.com',
|
|
272
|
-
pageTitle: null,
|
|
273
|
-
referrer: null,
|
|
274
|
-
});
|
|
275
|
-
tracker.trackPageViewEvent({
|
|
276
|
-
pageUrl: 'https://alloptionalsundefined.com',
|
|
277
|
-
pageTitle: undefined,
|
|
278
|
-
referrer: undefined,
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
const onPressTrackDeepLinkReceivedEvent = () => {
|
|
283
|
-
tracker.trackDeepLinkReceivedEvent({
|
|
284
|
-
url: 'https://deeplink.com',
|
|
285
|
-
referrer: 'http://refr.com',
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const onPressTrackMessageNotificationEvent = () => {
|
|
290
|
-
tracker.trackMessageNotificationEvent({
|
|
291
|
-
title: 'title1',
|
|
292
|
-
body: 'body1',
|
|
293
|
-
trigger: 'push',
|
|
294
|
-
action: 'action1',
|
|
295
|
-
attachments: [
|
|
296
|
-
{
|
|
297
|
-
identifier: 'att_id1',
|
|
298
|
-
type: 'att_type1',
|
|
299
|
-
url: 'http://att.url.1',
|
|
300
|
-
},
|
|
301
|
-
],
|
|
302
|
-
bodyLocArgs: ['bodyArg1', 'bodyArg2'],
|
|
303
|
-
bodyLocKey: 'bodyKey1',
|
|
304
|
-
category: 'category1',
|
|
305
|
-
contentAvailable: true,
|
|
306
|
-
group: 'group1',
|
|
307
|
-
icon: 'icon1',
|
|
308
|
-
notificationCount: 3,
|
|
309
|
-
notificationTimestamp: '2022-02-02T15:17:42.767Z',
|
|
310
|
-
sound: 'sound1',
|
|
311
|
-
subtitle: 'subtitle1',
|
|
312
|
-
tag: 'tag1',
|
|
313
|
-
threadIdentifier: 'threadIdentifier1',
|
|
314
|
-
titleLocArgs: ['titleArg1', 'titleArg2'],
|
|
315
|
-
titleLocKey: 'titleKey1',
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
const onPressShowMeSomeWarnings = () => {
|
|
320
|
-
tracker.trackSelfDescribingEvent({});
|
|
321
|
-
tracker.trackStructuredEvent({});
|
|
322
|
-
tracker.trackPageViewEvent({});
|
|
323
|
-
tracker.trackScreenViewEvent({});
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
const onPressTestSetSubject = async () => {
|
|
327
|
-
try {
|
|
328
|
-
await tracker.setSubjectData({
|
|
329
|
-
userId: 'nextTester',
|
|
330
|
-
domainUserId: '5d79770b-015b-4af8-8c91-b2ed6faf4b1e',
|
|
331
|
-
language: 'es',
|
|
332
|
-
colorDepth: 50,
|
|
333
|
-
timezone: 'Europe/London',
|
|
334
|
-
screenResolution: [300, 300],
|
|
335
|
-
});
|
|
336
|
-
await tracker.trackScreenViewEvent({ name: 'afterSetSubjectTestSV' });
|
|
337
|
-
} catch (e) {
|
|
338
|
-
console.log(e.message);
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const onPressTestSecondTracker = () => {
|
|
343
|
-
secTracker.trackScreenViewEvent({ name: 'fromSecondTracker' });
|
|
344
|
-
secTracker.trackStructuredEvent({
|
|
345
|
-
category: 'SecTracker',
|
|
346
|
-
action: 'trackStructured',
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const onPressTestAnonymousTracker = () => {
|
|
351
|
-
anonymousTracker.trackScreenViewEvent({ name: 'fromAnonymousTracker' });
|
|
352
|
-
anonymousTracker.trackStructuredEvent({
|
|
353
|
-
category: 'AnonymousTracker',
|
|
354
|
-
action: 'trackAnonymous',
|
|
355
|
-
});
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const onPressPlayGC = async () => {
|
|
359
|
-
try {
|
|
360
|
-
await tracker.removeGlobalContexts('testTag');
|
|
361
|
-
await tracker.addGlobalContexts({
|
|
362
|
-
tag: 'testTagReloaded',
|
|
363
|
-
globalContexts: [
|
|
364
|
-
{
|
|
365
|
-
schema:
|
|
366
|
-
'iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0',
|
|
367
|
-
data: { impressionId: 'test_global_contexts_Reloaded' },
|
|
368
|
-
},
|
|
369
|
-
],
|
|
370
|
-
});
|
|
371
|
-
await tracker.trackPageViewEvent({ pageUrl: 'afterGCChange.test' });
|
|
372
|
-
} catch (e) {
|
|
373
|
-
console.log(e.message);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
const onPressRemoveSecTracker = () => {
|
|
378
|
-
removeTracker('sp2');
|
|
379
|
-
// removeAllTrackers();
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
const onPressLogSessionData = async () => {
|
|
383
|
-
try {
|
|
384
|
-
const sessionUserId = await tracker.getSessionUserId();
|
|
385
|
-
const sessionId = await tracker.getSessionId();
|
|
386
|
-
const sessionIdx = await tracker.getSessionIndex();
|
|
387
|
-
const isInBg = await tracker.getIsInBackground();
|
|
388
|
-
const bgIndex = await tracker.getBackgroundIndex();
|
|
389
|
-
const fgIndex = await tracker.getForegroundIndex();
|
|
390
|
-
|
|
391
|
-
const sessionData = {
|
|
392
|
-
userId: sessionUserId,
|
|
393
|
-
sessionId: sessionId,
|
|
394
|
-
sessionIndex: sessionIdx,
|
|
395
|
-
isInBackground: isInBg,
|
|
396
|
-
backgroundIndex: bgIndex,
|
|
397
|
-
foregroundIndex: fgIndex,
|
|
398
|
-
};
|
|
399
|
-
console.log(
|
|
400
|
-
'SnowplowTracker: Session Data: ' + JSON.stringify(sessionData)
|
|
401
|
-
);
|
|
402
|
-
} catch (e) {
|
|
403
|
-
console.log(e.message);
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
return (
|
|
408
|
-
<SafeAreaView style={backgroundStyle}>
|
|
409
|
-
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
|
410
|
-
<ScrollView
|
|
411
|
-
testID="scrollView"
|
|
412
|
-
contentInsetAdjustmentBehavior="automatic"
|
|
413
|
-
style={backgroundStyle}
|
|
414
|
-
>
|
|
415
|
-
<Header />
|
|
416
|
-
<View
|
|
417
|
-
style={{
|
|
418
|
-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
|
419
|
-
}}
|
|
420
|
-
>
|
|
421
|
-
<Section title="Screen Views">
|
|
422
|
-
<Button
|
|
423
|
-
onPress={onPressTrackScreenViewEvent}
|
|
424
|
-
title="Track some Screen View Events"
|
|
425
|
-
color="#841584"
|
|
426
|
-
accessibilityLabel="testScreenView"
|
|
427
|
-
/>
|
|
428
|
-
</Section>
|
|
429
|
-
<Section title="Self-Describing Events">
|
|
430
|
-
<Button
|
|
431
|
-
onPress={onPressTrackSelfDescribingEvent}
|
|
432
|
-
title="Track some Self-Describing Events"
|
|
433
|
-
color="#841584"
|
|
434
|
-
accessibilityLabel="testSelfDesc"
|
|
435
|
-
/>
|
|
436
|
-
</Section>
|
|
437
|
-
<Section title="Structured Events">
|
|
438
|
-
<Button
|
|
439
|
-
onPress={onPressTrackStructuredEvent}
|
|
440
|
-
title="Track some Structured Events"
|
|
441
|
-
color="#841584"
|
|
442
|
-
accessibilityLabel="testStruct"
|
|
443
|
-
/>
|
|
444
|
-
</Section>
|
|
445
|
-
<Section title="Page Views">
|
|
446
|
-
<Button
|
|
447
|
-
onPress={onPressTrackPageViewEvent}
|
|
448
|
-
title="Track some Page View Events"
|
|
449
|
-
color="#841584"
|
|
450
|
-
accessibilityLabel="testPageView"
|
|
451
|
-
/>
|
|
452
|
-
</Section>
|
|
453
|
-
<Section title="Deep Link">
|
|
454
|
-
<Button
|
|
455
|
-
onPress={onPressTrackDeepLinkReceivedEvent}
|
|
456
|
-
title="Track a Deep Link Received Event"
|
|
457
|
-
color="#841584"
|
|
458
|
-
accessibilityLabel="testDeepLinkReceived"
|
|
459
|
-
/>
|
|
460
|
-
</Section>
|
|
461
|
-
<Section title="Message Notification">
|
|
462
|
-
<Button
|
|
463
|
-
onPress={onPressTrackMessageNotificationEvent}
|
|
464
|
-
title="Track a Message Notification Event"
|
|
465
|
-
color="#841584"
|
|
466
|
-
accessibilityLabel="testMessageNotification"
|
|
467
|
-
/>
|
|
468
|
-
</Section>
|
|
469
|
-
<Section title="Second tracker">
|
|
470
|
-
<Button
|
|
471
|
-
onPress={onPressTestSecondTracker}
|
|
472
|
-
title="Track events with second tracker"
|
|
473
|
-
color="#841584"
|
|
474
|
-
accessibilityLabel="testSecTracker"
|
|
475
|
-
/>
|
|
476
|
-
</Section>
|
|
477
|
-
<Section title="Anonymous tracker">
|
|
478
|
-
<Button
|
|
479
|
-
onPress={onPressTestAnonymousTracker}
|
|
480
|
-
title="Track events with anonymous tracking"
|
|
481
|
-
color="#841584"
|
|
482
|
-
accessibilityLabel="testAnonymousTracker"
|
|
483
|
-
/>
|
|
484
|
-
</Section>
|
|
485
|
-
<Section title="Warnings">
|
|
486
|
-
<Button
|
|
487
|
-
onPress={onPressShowMeSomeWarnings}
|
|
488
|
-
title="Show me some warnings"
|
|
489
|
-
color="#f6bd3b"
|
|
490
|
-
accessibilityLabel="testWrongInputs"
|
|
491
|
-
/>
|
|
492
|
-
</Section>
|
|
493
|
-
<Section title="Set the Subject">
|
|
494
|
-
<Button
|
|
495
|
-
onPress={onPressTestSetSubject}
|
|
496
|
-
title="Set the Subject again"
|
|
497
|
-
color="#228B22"
|
|
498
|
-
accessibilityLabel="testSetSubject"
|
|
499
|
-
/>
|
|
500
|
-
</Section>
|
|
501
|
-
<Section title="SessionData">
|
|
502
|
-
<Button
|
|
503
|
-
onPress={onPressLogSessionData}
|
|
504
|
-
title="Show me session data"
|
|
505
|
-
color="#f6bd3b"
|
|
506
|
-
accessibilityLabel="testSessionData"
|
|
507
|
-
/>
|
|
508
|
-
</Section>
|
|
509
|
-
|
|
510
|
-
<Section title="GC">
|
|
511
|
-
<Button
|
|
512
|
-
onPress={onPressPlayGC}
|
|
513
|
-
title="Remove and Add Global Contexts"
|
|
514
|
-
color="#228B22"
|
|
515
|
-
accessibilityLabel="testGC"
|
|
516
|
-
/>
|
|
517
|
-
</Section>
|
|
518
|
-
<Section title="Removals">
|
|
519
|
-
<Button
|
|
520
|
-
onPress={onPressRemoveSecTracker}
|
|
521
|
-
title="Remove Tracker"
|
|
522
|
-
color="#AA2222"
|
|
523
|
-
accessibilityLabel="testRemove"
|
|
524
|
-
/>
|
|
525
|
-
</Section>
|
|
526
|
-
<Section title="Web view">
|
|
527
|
-
{webViewEndpoint ? (
|
|
528
|
-
<WebView
|
|
529
|
-
onMessage={getWebViewCallback()}
|
|
530
|
-
source={{ uri: webViewEndpoint }}
|
|
531
|
-
style={{
|
|
532
|
-
height: 400,
|
|
533
|
-
width:
|
|
534
|
-
Dimensions.get('window').width -
|
|
535
|
-
styles.sectionContainer.paddingHorizontal,
|
|
536
|
-
}}
|
|
537
|
-
/>
|
|
538
|
-
) : null}
|
|
539
|
-
</Section>
|
|
540
|
-
</View>
|
|
541
|
-
</ScrollView>
|
|
542
|
-
</SafeAreaView>
|
|
543
|
-
);
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
const styles = StyleSheet.create({
|
|
547
|
-
sectionContainer: {
|
|
548
|
-
marginTop: 32,
|
|
549
|
-
marginBottom: 16,
|
|
550
|
-
paddingHorizontal: 24,
|
|
551
|
-
},
|
|
552
|
-
sectionTitle: {
|
|
553
|
-
fontSize: 24,
|
|
554
|
-
fontWeight: '600',
|
|
555
|
-
},
|
|
556
|
-
sectionDescription: {
|
|
557
|
-
marginTop: 8,
|
|
558
|
-
fontSize: 18,
|
|
559
|
-
fontWeight: '400',
|
|
560
|
-
},
|
|
561
|
-
highlight: {
|
|
562
|
-
fontWeight: '700',
|
|
563
|
-
},
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
export default App;
|