You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+4-3
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
## Installation
10
10
11
11
```
12
-
npm install --save nytm/nyt-react-tracking#v2.1.1
12
+
npm install --save nytm/nyt-react-tracking#v2.2.0
13
13
```
14
14
15
15
(Or whatever is the [latest version](https://github.com/nytm/nyt-react-tracking/releases))
@@ -142,7 +142,7 @@ Will dispatch the following data (assuming no other tracking data in context fro
142
142
### Top level `options.process`
143
143
144
144
When there's a need to implicitly dispatch an event with some data for *every* component, you can define an `options.process` function. This function should be declared once, at some top-level component. It will get called with each component's tracking data as the only argument. The returned object from this function will be merged with all the tracking context data and dispatched in `componentDidMount()`. If a falsy value is returned (`false`, `null`, `undefined`, ...), nothing will be dispatched.
145
-
\n\n
145
+
146
146
A common use case for this is to dispatch a `pageview` event for every component in the application that has a `page` property on its `trackingData`:
147
147
148
148
```js
@@ -158,7 +158,8 @@ class Page1 extends Component {...}
158
158
classPage2extendsComponent {...}
159
159
```
160
160
161
-
When `Page1` mounts, event with data `{page:'Page1', event:'pageview'}` will be dispatched. When `Page2` will be mounted nothing will be dispatched.
161
+
When `Page1` mounts, event with data `{page:'Page1', event:'pageview'}` will be dispatched.
0 commit comments