0.3.4 • Published 4 years ago

react-tracking-hotjar v0.3.4

Weekly downloads
30
License
MIT
Repository
github
Last release
4 years ago

React Tracking Hotjar

Build Status dependencies Status devDependencies Status License: MIT

Un-official module to easily add Hotjar pageview tracking to react apps. It functions as a tiny wrapper for the native script tag and window api. After initialization the Hotjar script is injected into the document.

Installation

With npm:

npm install react-tracking-hotjar --save

Usage

Before tracking any page views or events the tracker needs to be imported and initialized with the custom tracking id:

import HotjarTracking from 'react-tracking-hotjar';
HotjarTracking.initialize('TRACKING_ID');

There is also a method to expose the raw hj tracking object api from the window:

HotjarTracking.getTracker();

How this works

This modules takes care of injecting the provider specific tracking script into the document and provides a tiny wrapper for the tracking api. It also exposes the tracker object api for direct access.

Documentation for the raw tracker api can be found here.