How to use the react-ga.timing 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 kids-first / kf-portal-ui / src / services / analyticsTracking / googleAnalytics.js View on Github external
export const trackTiming = async eventData => {
  setUserDimensions();
  ReactGA.timing(
    merge(
      {
        category: null,
        variable: null,
        value: 0, // in milliseconds
        label: null,
      },
      eventData,
    ),
  );
};
github DefinitelyTyped / DefinitelyTyped / types / react-ga / react-ga-tests.ts View on Github external
it("Able to make timing calls", () => {
        ga.timing({
            category: 'string',
            variable: 'string',
            value: 1,
            label: 'string'
        });
    });
    it("Able to make exception calls", () => {
github aertslab / SCope / src / components / common / Viewer.jsx View on Github external
endBenchmark(msg) {
		var t2 = performance.now();
		let benchmark = this.state.benchmark[msg];
		let et = (t2 - benchmark.t1) || 0;
		if (DEBUG) console.log(this.props.name + ": benchmark - "+ benchmark.msg +": took " + et.toFixed(3) + " milliseconds.")
		ReactGA.timing({
			category: 'Backend',
			variable: benchmark.msg,
			value: et,
			label: this.props.name
		});
	}
github pastelsky / bundlephobia / pages / compare / ComparePage.js View on Github external
const newPackageString = `${results.name}@${results.version}`
        this.setState({
          inputInitialValue: newPackageString,
          results,
        }, () => {
          Router.replace(`/result?p=${newPackageString}`)
          Analytics.pageview(window.location.pathname)
        })

        Analytics.event({
          category: 'Search',
          action: 'Search Success',
          label: packageString.replace(/@/g, '[at]'),
        })

        Analytics.timing({
          category: 'Search',
          variable: 'result',
          value: Date.now() - startTime,
          label: packageString.replace(/@/g, '[at]'),
        });
      })
      .catch(err => {
github lbryio / lbry-desktop / ui / analytics.js View on Github external
function sendGaTimingEvent(category: string, action: string, timeInMs: number) {
  if (analyticsEnabled && isProduction) {
    ReactGA.timing(
      {
        category,
        variable: action,
        value: timeInMs,
      },
      [SECOND_TRACKER_NAME]
    );
  }
}
github alexieyizhe / intern.plus / src / utils / analytics.ts View on Github external
export const timing = (args: ReactGA.TimingArgs) => ReactGA.timing(args);
github elamperti / OpenWebScrobbler / src / App.js View on Github external
description: 'Invalid session key',
                fatal: true
              });
              this.props.logOut({
                type: 'warning',
                message: 'loginAgain',
                persistent: true,
                showErrorNumber: true,
                errorNumber: 401,
              });
              break;
            default:
              break;
          }
          if (response.config.timing) {
            ReactGA.timing({
              category: 'Client response time',
              variable: response.config.url,
              value: Math.round(response.config.timing.elapsedTime)
            });
          }
          if (response.data.error) {
            axiosErrorHandler(response);
          }
        }
        return response;
      },
      (error) => {
github wellcometrust / wellcomecollection.org / common / utils / analytics.js View on Github external
Router.onRouteChangeComplete = url => {
    window.performance.mark('onRouteChangeEnd');
    window.performance.measure(
      'onRouteChange',
      'onRouteChangeStart',
      'onRouteChangeEnd'
    );
    const measure = window.performance.getEntriesByName('onRouteChange')[0];
    ReactGA.timing({
      category: 'Navigation',
      variable: 'routeChange',
      value: Math.round(measure.duration),
      label: url
    });

    window.performance.clearMarks();
    window.performance.clearMeasures();
  };