Send GA pageview safely with async data.
$ npm install react-ga react-ga-hoc --save
import ga from 'react-ga';
import { pageview } from 'react-ga-hoc';
// SDK Setup
ga.initialize('id');
// Use HOC with Container
pageview(path)(
() => <div/>,
);
@pageview()
class Container extends React.Component {
render() {
return <div/>;
}
}
pageview(
?path: string,
): HigherOrderComponent
Arguments | Default | Description |
---|---|---|
path |
current path | path to be sent a pageview |
$ npm run lint
$ npm run test:watch
$ npm test
).