Skip to content

Instantly share code, notes, and snippets.

@btnwtn
Last active June 19, 2017 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btnwtn/bca69c3c32e4c700b28010a7c22fb2d5 to your computer and use it in GitHub Desktop.
Save btnwtn/bca69c3c32e4c700b28010a7c22fb2d5 to your computer and use it in GitHub Desktop.
const withTracking = WrappedRoute => {
return class PageViewWrapper extends Component {
componentDidMount() {
console.log(this.props);
if (window.dataLayer) {
window.dataLayer.push({
event: "pageview or something"
});
}
}
render() {
return <WrappedRoute {...this.props} />;
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment