Skip to content

Commit

Permalink
Add google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
coopy committed Jun 1, 2017
1 parent 29c1e5b commit 45c2620
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ReactGA from 'react-ga';
ReactGA.initialize('UA-40067241-3');

exports.onRouteUpdate = (state, page, pages) => {
const { pathname } = state;
ReactGA.set({ page: pathname });
ReactGA.pageview(pathname);
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"markdown-it-footnote": "^3.0.1",
"markdown-it-sub": "^1.0.0",
"object-assign": "^4.1.0",
"react-ga": "^2.2.0",
"react-headroom": "^2.1.2",
"react-helmet": "^3.2.2",
"react-responsive-grid": "^0.3.3",
Expand Down

0 comments on commit 45c2620

Please sign in to comment.