Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
history.listen(location => {
ReactGA.set({ page: location.hash })
ReactGA.pageview(location.hash)
// console.log(location.pathname, location.hash)
})
function logTrackingCalls() {
const calls = ReactGA.testModeAPI.calls;
for (let i = 0; i < calls.length; i++) {
// eslint-disable-next-line no-console
console.log('[react-ga]', ...calls[i]);
}
calls.length = 0;
}
function logTrackingCalls() {
const calls = ReactGA.testModeAPI.calls;
for (let i = 0; i < calls.length; i++) {
// eslint-disable-next-line no-console
console.log('[react-ga]', ...calls[i]);
}
calls.length = 0;
}
import store, { history } from './store';
import { GA_ID } from './config';
import {
setUser,
loginSetUserLocalStorageAndCookie
} from './user/actions/doUser';
import { GlobalStateProvider } from './state';
import 'bootstrap/dist/css/bootstrap.css';
import './App.css';
if (GA_ID && GA_ID !== '') {
ReactGA.initialize(GA_ID, {
debug: process.env.NODE_ENV === 'development'
});
ReactGA.pageview(window.location.pathname + window.location.search);
}
// Language
store.dispatch(doChangeLanguage(getDefaultLanguage()));
// User Authentication
const token = window.localStorage.getItem('token');
if (token && token !== 'undefined' && token !== '') {
const user = JSON.parse(window.localStorage.getItem('user'));
if (user) {
// Dispatch action
store.dispatch(setUser(token, user));
loginSetUserLocalStorageAndCookie(token, user);
}
}
// ui pieces
import SuperTitle from '../components/SuperTitle';
import GameSelect from '../components/GameSelect';
import Filter from '../components/Filter';
import HeaderIcon from '../components/HeaderIcon';
import Game from './Game';
import Notices from './Notices';
// environment vars
const env = process.env.REACT_STATIC_ENV;
// init google analytics
if (typeof document !== 'undefined' && env === 'production') {
ReactGA.initialize('UA-69148909-3');
ReactGA.pageview(window.location.pathname + window.location.search);
}
// add all the games to the redux store
if (store.getState().games.length === 0) {
gamesData.forEach(game => store.dispatch(addGame(game)));
}
class SmashTierList extends React.Component {
constructor(props) {
super();
const {
dispatch,
currentGame,
history,
route,
import React from 'react'
import { Router, Route, Link } from 'react-router'
import history from './utils/History.js'
//location: process.env.NODE_ENV === 'production' ? HashLocation : HistoryLocation,
//var router = require('./router'),
var routes = require('./routes'),
UIActions = require('./actions/commons/UIActions');
var attachFastClick = require('fastclick'),
ga = require('react-ga'),
GA_TRACKING_ID = require('./constants/defaults').GA_TRACKING_ID;
ga.initialize(GA_TRACKING_ID);
/* jshint ignore:start */
React.render({routes}, document.getElementById('app-wrapper'))
//router.run((Handler, state) => {
// ga.pageview(state.path);
// React.render(, document.getElementById('app-wrapper'));
//});
/* jshint ignore:end */
// for google analytics pageview
history.listen(function (location) {
ga.pageview(location.pathname);
});
import React from 'react';
import { Router } from 'react-router';
import { ApolloProvider } from 'react-apollo';
import ReactGA from 'react-ga';
import { AppContainer } from 'containers'; // eslint-disable-line
import client from './apolloClient';
import store, { history } from './store';
// initialize google analytics
if (typeof window !== 'undefined') {
ReactGA.initialize('UA-75828309-1');
}
/* eslint-disable */
// Polyfill for the System.import for webpack
if (typeof System === 'undefined') {
var System = {
import(path) {
return Promise.resolve(require(path));
},
};
}
/* eslint-enable */
// Switching to system.import to make use of dynamic tree shaking
// https://medium.com/modus-create-front-end-development/automatic-code-splitting-for-react-router-w-es6-imports-a0abdaa491e9#.msrxv8fwd
const errorLoading = err =>
render: function () {
const path = this.getPath().slice(1);
// logs the full path, including the hash, to google analytics (if analytics is enabled)
if (window.config.analytics) {
const fullHref = window.location.href;
const origin = window.location.origin;
const fullPathWithHash = fullHref.startsWith(origin) ? fullHref.slice(origin.length) : fullHref;
ReactGA.ga('send', 'pageview', fullPathWithHash);
}
return (
<div>
<footer>
</footer></div>
);
}
});
trackRouteUpdate(props) {
if (__SERVER__) return;
if (!this.state.initialized) return;
ReactGA.ga("send", "pageview", props.location.pathname);
// this.logTrack(props);
}
componentDidUpdate(prevProps, prevState) {
// Parse server errors for account add
if (get(prevProps, 'lockupError') !== this.props.lockupError) {
this.handleServerError(this.props.lockupError)
}
if (prevState.modalState !== this.state.modalState) {
ReactGA.modalview(`/lockup/${this.state.modalState.toLowerCase()}`)
}
}