Socket
Socket
Sign inDemoInstall

react-router-google-analytics

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-router-google-analytics

google analytics for react router (ready for server side rendering).


Version published
Weekly downloads
37
increased by15.63%
Maintainers
1
Install size
5.99 kB
Created
Weekly downloads
 

Readme

Source

NPM Version Build Status

react-router-google-analytics

The react router implementation for Google Analytics, server side rendring ready.

How to use

install

npm install react-router-google-analytics --save

setup

in your universal.js.

import Ga from 'react-router-google-analytics';

.
.
.

export function createClientApp(store, history, trackingCode, env) {
  const ga  = Ga(trackingCode);

  return (
    <Provider store={store}>
      <Router
         history={history}
         onUpdate={() => env === 'production' && ga('send', 'pageview', location.pathname)}
         >
        {routes}
      </Router>
    </Provider>
  );
}

export function createServerApp(store, props) {
  return (
    <Provider store={store}>
      <RouterContext {...props} />
    </Provider>
  );
}

Keywords

FAQs

Last updated on 10 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc