Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit a70b549

Browse files
committed
add analytics client side
1 parent 923f070 commit a70b549

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

client/js/plugins/analytics.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
module.exports = function (state, emitter) {
3+
var ga = null
4+
5+
emitter.on(state.events.DOMCONTENTLOADED, trackView)
6+
emitter.on(state.events.NAVIGATE, trackView)
7+
8+
function trackView () {
9+
const GAnalytics = require('ganalytics')
10+
if (!ga) ga = new GAnalytics('UA-49664853-1', { aid: 1, an: 'datbase' })
11+
ga.send('pageview')
12+
}
13+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"extend": "^3.0.0",
9393
"file-saver": "^1.3.2",
9494
"from2": "^2.3.0",
95+
"ganalytics": "^2.0.1",
9596
"get-form-data": "^1.2.5",
9697
"gravatar": "^1.6.0",
9798
"mime": "^1.3.4",

0 commit comments

Comments
 (0)