Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 739 Bytes

analytics.js.md

File metadata and controls

42 lines (34 loc) · 739 Bytes
title category layout updated intro
Google Analytics's analytics.js
Analytics
2017/sheet
2017-10-29
Google Analytics's analytics.js is deprecated.

Page view

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'
})