Adds Google Analytics Support

This commit is contained in:
Simon Reinsperger 2016-10-02 15:06:54 +02:00
parent fe4a4b1d8f
commit 326c15a9fc
3 changed files with 13 additions and 3 deletions

View File

@ -9,4 +9,6 @@ siteEmailUrl = "#"
siteRssUrl = "#"
siteVkUrl = "#"
googleAnalyticsId = ""
linkPrefix = "/gatsby-starter-lumen"

8
gatsby-browser.js Normal file
View File

@ -0,0 +1,8 @@
import ReactGA from 'react-ga'
import {config} from 'config'
ReactGA.initialize(config.googleAnalyticsId);
exports.onRouteUpdate = (state, page, pages) => {
ReactGA.pageview(state.pathname);
};

View File

@ -31,12 +31,12 @@
"gatsby": "^0.12.0",
"history": "^2.1.1",
"lodash": "^4.14.1",
"moment": "^2.14.1",
"markdown-it": "^6.0.2",
"moment": "^2.14.1",
"react": "^15.3.0",
"react-document-title": "^2.0.2",
"react-dom": "^15.3.0",
"react-google-analytics": "^0.2.0",
"react-ga": "^2.1.2",
"react-router": "^2.6.1",
"safe-access": "^0.1.0",
"underscore.string": "^3.2.3"
@ -65,4 +65,4 @@
"rucksack-css": "^0.8.5",
"lost": "^7.0.3"
}
}
}