react-router-ga
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -9,2 +9,3 @@ // @flow | ||
debug: boolean, | ||
trackPathnameOnly: boolean, | ||
children?: React.Node, | ||
@@ -53,2 +54,9 @@ location: Location, | ||
// Do nothing if trackPathnameOnly is enabled and the pathname didn't change. | ||
if (this.props.trackPathnameOnly && location.pathname === this.lastPathname) { | ||
return; | ||
} | ||
this.lastPathname = location.pathname; | ||
// Sets the page value on the tracker. | ||
@@ -55,0 +63,0 @@ window.ga('set', 'page', location.pathname); |
@@ -71,2 +71,9 @@ 'use strict'; | ||
// Do nothing if trackPathnameOnly is enabled and the pathname didn't change. | ||
if (this.props.trackPathnameOnly && location.pathname === this.lastPathname) { | ||
return; | ||
} | ||
this.lastPathname = location.pathname; | ||
// Sets the page value on the tracker. | ||
@@ -73,0 +80,0 @@ window.ga('set', 'page', location.pathname); |
{ | ||
"name": "react-router-ga", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
# react-router-ga | ||
Google Analytics component for React Router. | ||
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. | ||
@@ -11,2 +11,3 @@ ## Props | ||
| `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` | | ||
@@ -29,3 +30,2 @@ ## Usage Example | ||
<Route exact path="/login" component={Login} /> | ||
// your other routes | ||
</Switch> | ||
@@ -32,0 +32,0 @@ </App> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72131
144