JSPM

react-router-ga

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1436
  • Score
    100M100P100Q169285F
  • License MIT

Package Exports

  • react-router-ga

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-router-ga) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-router-ga

Google Analytics component for React Router.

Props

Prop Type Description Default value
id string Google Analytics tracking ID Required
debug boolean If enabled, react-router-ga will log all page views to the console false

Usage Example

import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import Analytics from 'react-router-ga';
import App from './containers/App';
import Login from './containers/Login';

ReactDOM.render(
  <BrowserRouter>
    <Analytics id="UA-111111111-1" debug>
      <App>
        <Switch>
          <Route exact path="/login" component={Login} />
          // your other routes
        </Switch>
      </App>
    </Analytics>
  </BrowserRouter>,
  document.getElementById('root')
);

Dependencies

This project has react@^16.2.0 and react-router-dom@^4.2.2 as peer dependencies.