analytics.js: add
This commit is contained in:
parent
8facba27b0
commit
e482109fc5
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: Google Analytics's analytics.js
|
||||
category: Analytics
|
||||
layout: 2017/sheet
|
||||
updated: DATE
|
||||
intro: |
|
||||
Google Analytics's analytics.js is deprecated.
|
||||
|
||||
### Page view
|
||||
|
||||
```js
|
||||
ga('create', 'UA-XXXX-Y', 'auto')
|
||||
ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' })
|
||||
```
|
||||
|
||||
```js
|
||||
ga('send', 'pageview')
|
||||
ga('send', 'pageview', { 'dimension15': 'My custom dimension' })
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
```js
|
||||
ga('send', 'event', 'button', 'click', {color: 'red'});
|
||||
```
|
||||
|
||||
```js
|
||||
ga('send', 'event', 'button', 'click', 'nav buttons', 4);
|
||||
/* ^category ^action ^label ^value */
|
||||
```
|
||||
|
||||
### Exceptions
|
||||
|
||||
```js
|
||||
ga('send', 'exception', {
|
||||
exDescription: 'DatabaseError',
|
||||
exFatal: false,
|
||||
appName: 'myapp',
|
||||
appVersion: '0.1.2'
|
||||
})
|
||||
```
|
54
analytics.md
54
analytics.md
|
@ -1,43 +1,31 @@
|
|||
---
|
||||
title: Analytics
|
||||
title: Analytics libraries
|
||||
layout: 2017/sheet
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### Mixpanel
|
||||
|
||||
Identify:
|
||||
```js
|
||||
mixpanel.identify('284');
|
||||
mixpanel.people.set({ $email: 'hi@gmail.com' });
|
||||
mixpanel.register({ age: 28, gender: 'male' }); /* set common properties */
|
||||
```
|
||||
|
||||
mixpanel.identify('284');
|
||||
mixpanel.people.set({ $email: 'hi@gmail.com' });
|
||||
mixpanel.register({ age: 28, gender: 'male' }); /* set common properties */
|
||||
[mixpanel](./mixpanel)
|
||||
{: .-crosslink}
|
||||
|
||||
Events:
|
||||
### Google Analytics's analytics.js
|
||||
|
||||
mixpanel.track('Login success');
|
||||
mixpanel.track('Search', { query: 'cheese' });
|
||||
```js
|
||||
ga('create', 'UA-XXXX-Y', 'auto');
|
||||
ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' });
|
||||
```
|
||||
|
||||
References:
|
||||
```js
|
||||
ga('send', 'pageview');
|
||||
ga('send', 'pageview', { 'dimension15': 'My custom dimension' });
|
||||
```
|
||||
|
||||
* https://mixpanel.com/help/reference/javascript
|
||||
|
||||
### analytics.js
|
||||
|
||||
ga('create', 'UA-XXXX-Y', 'auto');
|
||||
ga('create', 'UA-XXXX-Y', { userId: 'USER_ID' });
|
||||
|
||||
ga('send', 'pageview');
|
||||
ga('send', 'pageview', { 'dimension15': 'My custom dimension' });
|
||||
|
||||
Events:
|
||||
|
||||
ga('send', 'event', 'button', 'click', {color: 'red'});
|
||||
ga('send', 'event', 'button', 'click', 'nav buttons', 4);
|
||||
/* ^category ^action ^label ^value */
|
||||
|
||||
Exceptions:
|
||||
|
||||
ga('send', 'exception', {
|
||||
exDescription: 'DatabaseError',
|
||||
exFatal: false,
|
||||
appName: 'myapp',
|
||||
appVersion: '0.1.2'
|
||||
})
|
||||
[analytics.js](./analytics.js)
|
||||
{: .-crosslink}
|
||||
|
|
Loading…
Reference in New Issue