How to use the react-ga.pageview function in react-ga

To help you get started, we’ve selected a few react-ga examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github victordibia / anomagram / app / src / components / Main.jsx View on Github external
history.listen(location => {
    ReactGA.set({ page: location.hash })
    ReactGA.pageview(location.hash)
    // console.log(location.pathname, location.hash)
})
github dvaJi / ReaderFront / src / Root.js View on Github external
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);
  }
}
github umarsheikh13 / elmtimes / src / components / Body / index.js View on Github external
componentDidMount() {
        if ('gaid' in this.props.options) {
            ReactGA.initialize(this.props.options.gaid);
            ReactGA.pageview(window.location.pathname + window.location.search);
        }
    }
github cncjs / cncjs / src / app / lib / analytics.js View on Github external
pageview: (page) => {
        GoogleAnalytics.pageview(page);
    },
    modalview: (modalName) => {
github AJInteractive / InterviewJS / packages / viewer / src / index.js View on Github external
const pageView = () => ReactGA.pageview(document.location.pathname);
github ArcBlock / forge-js / apps / forge-web / src / components / withTracker.js View on Github external
const trackPage = page => {
    if (process.env.NODE_ENV !== 'production') {
      return;
    }

    ReactGA.set({
      page,
      ...options,
    });

    ReactGA.pageview(page);
    ABA.pageview(page);
  };
github atanasster / grommet-nextjs / components / utils / analytics.js View on Github external
export const logPageView = () => {
  ReactGA.set({
    page: window.location.pathname,
  });
  ReactGA.pageview(window.location.pathname);
};
github Vizzuality / climate-watch / app / javascript / app / layouts / root / root.js View on Github external
function trackPage(page) {
  ReactGA.set({ page });
  ReactGA.pageview(page);
}
github wulkano / getkap.co / components / sections / footer-slim / links.js View on Github external
        onClick={() => ReactGA.pageview('/download')}
        href="https://kap-updates.now.sh/download"