Skip to content
This repository has been archived by the owner on Nov 17, 2017. It is now read-only.

Commit

Permalink
Merge pull request #63 from snegostup/master
Browse files Browse the repository at this point in the history
Proper tracking of route change with Google Analytics
  • Loading branch information
gpbl committed Jul 6, 2015
2 parents 35226e8 + 36b731b commit fd816b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Application extends Component {
}

if (!Immutable.is(prevProps.currentRoute, currentRoute)) {
trackPageView();
trackPageView(currentRoute.get('url'));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/trackPageView.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Track a pageview with Google Analytics
// (this code must run only on client!)

function trackPageView() {
function trackPageView(path) {
if (!window.ga) {
return;
}

window.ga("send", "pageview");
window.ga("send", "pageview", path);
}

export default trackPageView;

0 comments on commit fd816b1

Please sign in to comment.