Skip to content

Commit 7110084

Browse files
committed
Update README
1 parent 89e79c0 commit 7110084

File tree

2 files changed

+32
-30
lines changed

2 files changed

+32
-30
lines changed

README.md

+29-27
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Snowplow is a scalable open-source platform for rich, high quality, low-latency
1111

1212
## Snowplow WebView Tracker Overview
1313

14-
The Snowplow WebView Tracker allows you to add analytics to your Web views embedded in mobile apps when using a [Snowplow][snowplow] pipeline.
14+
The Snowplow WebView Tracker allows you to add analytics to your WebViews embedded in mobile apps when using a [Snowplow][snowplow] pipeline.
1515

16-
The WebView tracker should be integrated in Web apps used in Web views within native mobile apps. The tracker provides APIs to track Snowplow events. It forwards the events to the native app code to be tracked by the Snowplow mobile trackers ([iOS][ios-tracker], [Android tracker][android-tracker], or [React Native][react-native-tracker]). The diagram below shows the interaction of the WebView and mobile trackers in hybrid apps.
16+
The WebView tracker should be integrated in Web apps used in WebViews within native mobile apps. The tracker provides APIs to track Snowplow events. It forwards the events to the native app code to be tracked by the Snowplow mobile trackers ([iOS][ios-tracker], [Android][android-tracker], or [React Native][react-native-tracker]). The diagram below shows the interaction of the WebView and mobile trackers in hybrid apps.
1717

1818
```mermaid
1919
flowchart TB
@@ -44,8 +44,6 @@ end
4444
nativeTracker -- "Sends tracked events" --> collector
4545
```
4646

47-
**Technical documentation can be found for each tracker in our [Hybrid Apps accelerator][webview-docs].**
48-
4947
## Quick Start
5048

5149
### Installation from npm
@@ -59,10 +57,10 @@ npm install --save @snowplow/webview-tracker
5957
You will then be able to use the functions provided by the WebView tracker as follows:
6058

6159
```typescript
62-
import { trackSelfDescribingEvent } from '@snowplow/webview-tracker';
60+
import { trackWebViewEvent } from '@snowplow/webview-tracker';
6361
```
6462

65-
In addition, you will need to install the iOS or Android tracker in your native code and configure and initialize a tracker (see the [mobile tracker docs][mobile-tracker-setup-docs]). Afterwards, you will be able to subscribe to and track the events from the WebView tracker in a Web view by calling `Snowplow.subscribeToWebViewEvents(webView)`.
63+
In addition, you will need to install the [iOS][ios-tracker], [Android][android-tracker], or [React Native][react-native-tracker] tracker in your native code and configure and initialize a tracker. Afterwards, you will be able to subscribe to and track the events from the WebView tracker in a WebView.
6664

6765
### Installation with the Snowplow tag
6866

@@ -79,32 +77,36 @@ You may download the `sp.js` file from the Releases section Github, self-host it
7977
To track events, simply call their corresponding functions given the event data:
8078

8179
```javascript
82-
trackSelfDescribingEvent({
80+
trackWebViewEvent({
81+
properties: {
82+
eventName: 'ue',
83+
trackerVersion: 'webview',
84+
},
8385
event: {
84-
schema: 'iglu:com.example_company/save_game/jsonschema/1-0-2',
85-
data: {
86-
'saveId': '4321',
87-
'level': 23,
88-
'difficultyLevel': 'HARD',
89-
'dlContent': true
90-
}
91-
}
92-
});
86+
schema:
87+
'iglu:com.snowplowanalytics.snowplow/button_click/jsonschema/1-0-0',
88+
data: {
89+
label: 'webview test',
90+
},
91+
},
92+
});
9393
```
9494

9595
In case you loaded the tracker using the Snowplow tag, you will be able to access the APIs using `window.snowplow`:
9696

9797
```javascript
98-
window.snowplow('trackSelfDescribingEvent', {
98+
window.snowplow('trackWebViewEvent', {
99+
properties: {
100+
eventName: 'ue',
101+
trackerVersion: 'webview',
102+
},
99103
event: {
100-
schema: 'iglu:com.example_company/save_game/jsonschema/1-0-2',
101-
data: {
102-
'saveId': '4321',
103-
'level': 23,
104-
'difficultyLevel': 'HARD',
105-
'dlContent': true
106-
}
107-
}
104+
schema:
105+
'iglu:com.snowplowanalytics.snowplow/button_click/jsonschema/1-0-0',
106+
data: {
107+
label: 'webview test',
108+
},
109+
},
108110
});
109111
```
110112

@@ -113,14 +115,14 @@ Please refer to the [tracker documentation][webview-docs] to learn more about th
113115
## Find Out More
114116

115117
| Technical Docs |
116-
|---------------------------------------|
118+
| ------------------------------------- |
117119
| [![i1][techdocs-image]][webview-docs] |
118120
| [Technical Docs][webview-docs] |
119121

120122
## Maintainers
121123

122124
| Contributing |
123-
|----------------------------------------------|
125+
| -------------------------------------------- |
124126
| [![i4][contributing-image]](CONTRIBUTING.md) |
125127
| [Contributing](CONTRIBUTING.md) |
126128

src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ export function hasMobileInterface(): boolean {
9696

9797
/**
9898
* Track a web event.
99+
* This method allows the tracking of any Snowplow event. It is used by the Snowplow web tracker WebView plugin to forward events to mobile trackers.
100+
* Use this method to track either Self-Describing events, which are described by schemas, or that are not i.e. PageView and Structured events.
99101
*
100-
* @param atomicProperties - The atomic properties
101-
* @param event - Self-describing event information
102-
* @param entities - Entities to attach to the event
102+
* @param event - Event information
103103
* @param trackers - The tracker identifiers which the event will be sent to
104104
*/
105105
export function trackWebViewEvent(

0 commit comments

Comments
 (0)