All Projects → fed → React Router Ga

fed / React Router Ga

Licence: mit
Google Analytics component for React Router

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Router Ga

React Sight
Visualization tool for React, with support for Fiber, Router (v4), and Redux
Stars: ✭ 2,716 (+4015.15%)
Mutual labels:  react-component, react-router
whatsapp-clone-react
Build a WhatsApp Clone with React JS and FireBase.
Stars: ✭ 38 (-42.42%)
Mutual labels:  react-router, react-component
React Router Active Component
Factory function for React components which are active for a particular React Router route
Stars: ✭ 116 (+75.76%)
Mutual labels:  react-component, react-router
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (+218.18%)
Mutual labels:  react-router, react-component
react-pits
React 中的坑
Stars: ✭ 29 (-56.06%)
Mutual labels:  react-router, react-component
React Router Server
Server Side Rendering library for React Router v4.
Stars: ✭ 443 (+571.21%)
Mutual labels:  react-component, react-router
awesome-web-react
🚀 Awesome Web Based React 🚀 Develop online with React!
Stars: ✭ 31 (-53.03%)
Mutual labels:  react-router, react-component
git-issue-react-electronjs
⚙️. ⚛️. A desktop application created with Electronjs and Reactjs to be cross-platform to manage and track GitHub issues.
Stars: ✭ 21 (-68.18%)
Mutual labels:  react-router, react-component
React Router Form
<Form> is to <form> as <Link> is to <a>
Stars: ✭ 58 (-12.12%)
Mutual labels:  react-component, react-router
React Router Util
Useful components and utilities for working with React Router
Stars: ✭ 320 (+384.85%)
Mutual labels:  react-component, react-router
Slopeninja Frontend
Slope Ninja Frontend 🏂❄️⛄️
Stars: ✭ 39 (-40.91%)
Mutual labels:  google-analytics, react-router
React Filtered Multiselect
Filtered multi-select React component
Stars: ✭ 61 (-7.58%)
Mutual labels:  react-component
Kindmetrics
Kind metrics analytics for your website
Stars: ✭ 57 (-13.64%)
Mutual labels:  google-analytics
React Stonecutter
Animated grid layout component for React
Stars: ✭ 1,089 (+1550%)
Mutual labels:  react-component
Egg React Typescript Boilerplate
Egg React TypeScript Server Side Render (SSR) / Client Side Render (CSR)
Stars: ✭ 56 (-15.15%)
Mutual labels:  react-router
React Hover
React hover --- make hover easy http://cht8687.github.io/react-hover/example/
Stars: ✭ 64 (-3.03%)
Mutual labels:  react-component
Koa React Notes Web
🤓 A simple SPA built using Koa (2.5.1) as the backend and React (16.4.1) as the frontend. Features MySQL integration, user authentication, CRUD note actions, and more.
Stars: ✭ 61 (-7.58%)
Mutual labels:  react-router
React Cool Starter
😎 🐣 A starter boilerplate for a universal web app with the best development experience and a focus on performance and best practices.
Stars: ✭ 1,083 (+1540.91%)
Mutual labels:  react-router
Piwik React Router
Piwik analytics component for react-router
Stars: ✭ 53 (-19.7%)
Mutual labels:  react-router
React Mobx Ts Antd
A simple empty project build with react、react-router、mobx、antd in typescript.
Stars: ✭ 53 (-19.7%)
Mutual labels:  react-router

react-router-ga

Downloads Version License

Google Analytics component for React Router. Bear in mind this is a super simple implementation that only logs page views. Logging of custom events, exceptions, user timings or social interactions is currently not supported.

Props

Prop Type Description Default value
id string Google Analytics tracking ID Required
basename string If provided, react-router-ga will prepend the basename to the pathname of each page view. (This should match the basename provided to the React Router BrowserRouter component. See here for documentation.) -
debug boolean If enabled, react-router-ga will log all page views to the console false
trackPathnameOnly boolean If enabled, react-router-ga will only send page views when the pathname changed 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 { Home, Login, NoMatch } from './components';

ReactDOM.render(
  <BrowserRouter>
    <Analytics id="UA-123456789-0" debug>
      <Switch>
        <Route exact path="/" component={Home}/>
        <Route exact path="/login" component={Login} />
        <Route component={NoMatch} />
      </Switch>
    </Analytics>
  </BrowserRouter>,
  document.getElementById('root')
);

Demo App

You can also have a look at the demo app in the example directory. This app is bootstrapped with create-react-app and is making use of both react-router and react-router-ga.

Probably the code sample you are looking for is in the example/src/index.js file.

Dependencies

This project has [email protected]^16.0.0 and [email protected]^4.0.0 as peer dependencies.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].