How to use the react-ga.ga 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 BRCAChallenge / brca-exchange / website / js / index.js View on Github external
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>
        );
    }
});
github ManifoldScholar / manifold / client / src / hoc / analytics / index.js View on Github external
trackRouteUpdate(props) {
    if (__SERVER__) return;
    if (!this.state.initialized) return;
    ReactGA.ga("send", "pageview", props.location.pathname);
    // this.logTrack(props);
  }
github GeorgioWan / oCongrats / src / components / Lottery.js View on Github external
handleLottery( type ) {
        const { quota } = this.state;
        const bang = this.getLotteryList( type );
        
        if( type === 0 ) {
            FB.AppEvents.logEvent("handleLottery", quota, {CONTENT_TYPE: 'reactions'});
            ReactGA.ga('send', 'handleLottery', 'reactions');
        }
        else if ( type === 1 ){
            FB.AppEvents.logEvent("handleLottery", quota, {CONTENT_TYPE: 'comments'});
            ReactGA.ga('send', 'handleLottery', 'comments');
        }
        else if ( type === 2 ){
            FB.AppEvents.logEvent("handleLottery", quota, {CONTENT_TYPE: 'shareds'});
            ReactGA.ga('send', 'handleLottery', 'shareds');
        }
        
        this.setState({ 
            bang,
            loading: true
        });
        
        setTimeout(()=>{
github luangjokaj / i4h / src / Views / Pages / Animation.js View on Github external
componentWillMount() {
		this.loadPage(this.props);
		ReactGA.ga('send', 'pageview', `${this.props.location && this.props.location.pathname}`);
	}
github tohjustin / coincharts / src / index.js View on Github external
import MainView from "./views/MainView";
import configureStore from "./store/configureStore";
import * as serviceWorker from "./serviceWorker";

import "./styles/normalize.css";
import "./styles/base.css";

if (process.env.NODE_ENV === "production" &amp;&amp; process.env.REACT_APP_RAVEN_PUBLIC_DSN) {
  Raven.config(process.env.REACT_APP_RAVEN_PUBLIC_DSN, {
    release: process.env.REACT_APP_VERSION,
  }).install();
}

if (process.env.NODE_ENV === "production" &amp;&amp; process.env.REACT_APP_GA_TRACKING_ID) {
  ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID);
  ReactGA.ga("set", "anonymizeIp", true);
  ReactGA.pageview(window.location.pathname + window.location.search);
}

ReactDOM.render(
  
    
      
    
  ,
  document.getElementById("root"),
);

serviceWorker.register();
github joelongstreet / data-forms / src / Analytics.js View on Github external
import React from 'react';
import FullStory, { FullStoryAPI } from 'react-fullstory';
import GA from 'react-ga';

const env = process.env.NODE_ENV;
const isProduction = env === 'production';

if (isProduction) {
  GA.initialize('UA-137049621-1');
  GA.ga((tracker) =&gt; {
    const trackerClientId = tracker.get('clientId');

    const fullstoryInitted = setInterval(() =&gt; {
      if (window._fs_namespace) {
        FullStoryAPI('identify', trackerClientId);
        clearInterval(fullstoryInitted);
      }
    }, 500);
  });
}

function Analytics() {
  return (
    
      { isProduction
        &amp;&amp;
github luangjokaj / i4h / src / Views / Search / Search.js View on Github external
componentWillMount() {
		this.fetchPage(this.props);
		ReactGA.ga('send', 'pageview', `${this.props.location && this.props.location.pathname}`);
	}
github luangjokaj / i4h / src / Views / Pages / Portfolio.js View on Github external
componentWillMount() {
		this.loadPage(this.props);
		ReactGA.ga('send', 'pageview', `${this.props.location && this.props.location.pathname}`);
	}
github luangjokaj / i4h / src / Views / Pages / Detail.js View on Github external
componentWillMount() {
		this.fetchPage(this.props);
		ReactGA.ga(
			'send',
			'pageview',
			`${this.props.location && this.props.location.pathname}`
		);
	}
github 5calls / 5calls / src / components / done / Done.tsx View on Github external
donateClick(amount: number) {
    const ga = ReactGA.ga();
    ga('send', 'event', 'donate', amount, amount);

    window.open(Constants.DONATE_URL + '?amount=' + amount, '_blank');
  }