File tree 5 files changed +21
-32
lines changed
5 files changed +21
-32
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,9 @@ import {
58
58
To use them, just specify the event type in your event definition:
59
59
60
60
` ` ` js
61
- const pageView = {
62
- eventFields: (action): LogEvent => ({
63
- hitType: 'logEvent',
64
- eventType: 'pageview',
65
- eventProperties: {
66
- page: action.payload,
67
- },
68
- }),
69
- };
61
+ const pageView = (action): LogEvent => ({
62
+ hitType: 'logEvent',
63
+ eventType: 'pageview',
64
+ eventProperties: { page: action.payload },
65
+ });
70
66
` ` `
Original file line number Diff line number Diff line change 3
3
### Set Up
4
4
5
5
1 . Sign up for Google Analytics if you haven't already, and
6
- [ create a new mobile property] ( https://support.google.com/analytics/answer/1008015?hl=en ) . (Note, that it
6
+ [ create a new mobile property] ( https://support.google.com/analytics/answer/1008015?hl=en ) . (Note, that it
7
7
must be a mobile app property, not a web property.) Make a note of your property's
8
8
[ tracking Id] ( https://support.google.com/analytics/answer/1008080 ) .
9
9
13
13
14
14
> ** Tip:**
15
15
> If you are using Ionic, initialize it in the onready callback. You may also want to install
16
- the Angular 2 tooling from [ http://ionicframework.com/docs/native/google-analytics/ ] ( http://ionicframework.com/docs/native/google-analytics/ )
16
+ the Angular 2 tooling from [ http://ionicframework.com/docs/native/google-analytics/ ] ( http://ionicframework.com/docs/native/google-analytics/ )
17
17
18
18
3 . Import the target, then provide it when creating middleware or a meta reducer:
19
19
26
26
27
27
### Usage
28
28
29
- Each event passed to the target is pushed to Google Analytics via the
29
+ Each event passed to the target is pushed to Google Analytics via the
30
30
Google Analytics Plugin which installs the Google Analytics mobile SDK. The
31
31
generated event must have a ` hitType ` property specifying the type of
32
32
analytics event and any other properties required for the event type.
@@ -61,10 +61,8 @@ import {
61
61
To use them, just specify the event type in your event definition:
62
62
63
63
``` js
64
- const pageView = {
65
- eventFields: (action): PageView => ({
66
- hitType: ' pageview' ,
67
- page: action .payload ,
68
- }),
69
- };
64
+ const pageView = (action): PageView => ({
65
+ hitType: ' pageview' ,
66
+ page: action .payload ,
67
+ });
70
68
```
Original file line number Diff line number Diff line change 47
47
48
48
` ` ` js
49
49
// Given the following event definition
50
- const pageview = {
51
- eventFields: action => ({
52
- hitType: 'pageview',
53
- page: action.payload,
54
- }),
55
- };
50
+ const pageview = action => ({
51
+ hitType: 'pageview',
52
+ page: action.payload,
53
+ });
54
+
56
55
// Say the action is equal to
57
56
// { type: LOCATION_CHANGE, payload: '/home' }
58
57
// The following object will get pushed to the dataLayer
Original file line number Diff line number Diff line change 25
25
const analyticsMiddleware = createMiddleware (eventsMap, target);
26
26
```
27
27
28
-
29
-
30
28
### Example
31
29
* [ Redux Beacon: React Native Google Analytics Example] ( https://github.com/johannalee/react-native-redux-example )
Original file line number Diff line number Diff line change @@ -42,10 +42,8 @@ import {
42
42
To use it, just specify the Segment.io event in your event definition:
43
43
44
44
``` js
45
- const pageView = {
46
- eventFields: (action): PageView => ({
47
- hitType: ' pageview' ,
48
- page: action .payload ,
49
- }),
50
- };
45
+ const pageView = (action): PageView => ({
46
+ hitType: ' pageview' ,
47
+ page: action .payload ,
48
+ });
51
49
```
You can’t perform that action at this time.
0 commit comments