Merge pull request #15 from abisz/master

Adds Google Analytics Support (closes #12)
This commit is contained in:
Alexander S 2016-10-03 02:07:23 +03:00 committed by GitHub
commit 512a7d471d
3 changed files with 13 additions and 3 deletions

View File

@ -9,4 +9,6 @@ siteEmailUrl = "#"
siteRssUrl = "#" siteRssUrl = "#"
siteVkUrl = "#" siteVkUrl = "#"
googleAnalyticsId = ""
linkPrefix = "/gatsby-starter-lumen" 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", "gatsby": "^0.12.0",
"history": "^2.1.1", "history": "^2.1.1",
"lodash": "^4.14.1", "lodash": "^4.14.1",
"moment": "^2.14.1",
"markdown-it": "^6.0.2", "markdown-it": "^6.0.2",
"moment": "^2.14.1",
"react": "^15.3.0", "react": "^15.3.0",
"react-document-title": "^2.0.2", "react-document-title": "^2.0.2",
"react-dom": "^15.3.0", "react-dom": "^15.3.0",
"react-google-analytics": "^0.2.0", "react-ga": "^2.1.2",
"react-router": "^2.6.1", "react-router": "^2.6.1",
"safe-access": "^0.1.0", "safe-access": "^0.1.0",
"underscore.string": "^3.2.3" "underscore.string": "^3.2.3"