2015-07-27 18:06:02 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
import { altThirdParty } from '../alt';
|
2015-07-27 18:06:02 +02:00
|
|
|
import EventActions from '../actions/event_actions';
|
|
|
|
|
|
|
|
class GoogleAnalyticsHandler {
|
|
|
|
constructor() {
|
|
|
|
this.bindActions(EventActions);
|
|
|
|
}
|
|
|
|
|
|
|
|
onRouteDidChange() {
|
|
|
|
window.ga('send', 'pageview');
|
|
|
|
}
|
|
|
|
|
|
|
|
onApplicationWillBoot(settings) {
|
|
|
|
if (settings.ga) {
|
|
|
|
window.ga('create', settings.ga, 'auto');
|
|
|
|
console.log('Google Analytics loaded');
|
|
|
|
} else {
|
|
|
|
console.log('Cannot load Google Analytics: no tracking code provided');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-06 16:47:59 +02:00
|
|
|
export default altThirdParty.createStore(GoogleAnalyticsHandler, 'GoogleAnalyticsHandler');
|