mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
GA SPA integration
This commit is contained in:
13
src/index.js
13
src/index.js
@@ -87,6 +87,19 @@ function restoreScroll() {
|
||||
}, 200);
|
||||
}
|
||||
|
||||
browserHistory.listen(trackPageView);
|
||||
|
||||
function trackPageView(location) {
|
||||
const ga = window.ga;
|
||||
|
||||
if (!ga) {
|
||||
return;
|
||||
}
|
||||
|
||||
ga('set', 'page', location.pathname + location.search);
|
||||
ga('send', 'pageview');
|
||||
}
|
||||
|
||||
/* global process: false */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// some shortcuts for testing on localhost
|
||||
|
Reference in New Issue
Block a user