improve performance for reporting
This commit is contained in:
parent
51eb1bd011
commit
19a62a6f60
14
index.html
14
index.html
|
@ -5,15 +5,15 @@
|
|||
<link rel="shortcut icon" type="image/png" href="./favicon32.png">
|
||||
</head>
|
||||
<body>
|
||||
<script src="./dist/bundle.js"></script>
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
||||
window.ga('create', 'UA-48498113-3', 'auto');
|
||||
window.ga('set', 'page', window.location.pathname + window.location.hash);
|
||||
window.ga('send', 'pageview');
|
||||
|
||||
ga('create', 'UA-48498113-1', 'philschatz.com');
|
||||
</script>
|
||||
<script src="./dist/bundle.js"></script>
|
||||
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -15,7 +15,6 @@ const App = React.createClass({
|
|||
componentDidMount() {
|
||||
SettingsStore.on('change:tableLayout', this.onChange);
|
||||
this._historyListener = history.listen(this.storeHistory);
|
||||
this.storeHistory({path: this.props.route.path});
|
||||
},
|
||||
componentWillMount() {
|
||||
SettingsStore.off('change:tableLayout', this.onChange);
|
||||
|
@ -30,7 +29,9 @@ const App = React.createClass({
|
|||
},
|
||||
storeHistory(locationChangeEvent) {
|
||||
if (window.ga) {
|
||||
window.ga('set', 'page', '/gh-board' + locationChangeEvent.pathname);
|
||||
const {pathname, hash} = window.location;
|
||||
window.ga('set', 'page', pathname + hash);
|
||||
// window.ga('set', 'page', '/gh-board/#' + locationChangeEvent.pathname + locationChangeEvent.search);
|
||||
window.ga('send', 'pageview');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -30,6 +30,15 @@ Timer.setMaxListeners(0);
|
|||
let timerTimeout = null;
|
||||
const timerFn = () => {
|
||||
Timer.emit('tick');
|
||||
if (window.ga) {
|
||||
window.ga('send', 'event', {
|
||||
eventCategory: 'visibility',
|
||||
eventAction: 'poll',
|
||||
eventValue: document.hidden ? 0 : 1,
|
||||
eventLabel: document.hidden ? 'Hidden' : 'Visible'
|
||||
});
|
||||
}
|
||||
|
||||
// const d = new Date();
|
||||
// console.log('tick', d.getMinutes(), d.getSeconds());
|
||||
timerTimeout = setTimeout(timerFn, getReloadTime());
|
||||
|
@ -41,6 +50,15 @@ const handleVisibilityChange = () => {
|
|||
clearTimeout(timerTimeout);
|
||||
timerFn();
|
||||
}
|
||||
if (window.ga) {
|
||||
window.ga('send', 'event', {
|
||||
eventCategory: 'visibility',
|
||||
eventAction: 'change',
|
||||
eventValue: document.hidden ? 0 : 1,
|
||||
eventLabel: document.hidden ? 'Hidden' : 'Visible'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange, false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue