|
Download wp-calypso/client/lib/analytics/with-tracking-tool/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 944 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/analytics/with-tracking-tool/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/lib/analytics/with-tracking-tool/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/lib/analytics/with-tracking-tool/README.md
944 Bytes
withTrackingTool
This high-order component allows us to load a tracking tool when component gets mounted.
The withTrackingTool is called with a trackingTool parameter. Currently, only the HotJar tracking tool is supported.
The return is a wrapper function that takes your component and loads the specified tracking tool on top of it.
Usage
When directly wrapping a component:
import withTrackingTool from 'calypso/lib/analytics/with-tracking-tool';
class MyComponent {
render() {
// Something
}
}
export default withTrackingTool( 'HotJar' )( MyComponent );
When combined with other wrappers (like localize()):
import { localize } from 'i18n-calypso';
import { flowRight } from 'lodash';
import withTrackingTool from 'calypso/lib/analytics/with-tracking-tool';
class MyComponent {
render() {
// Something
}
}
export default flowRight( localize, withTrackingTool( 'HotJar' ) )( MyComponent );