How to use react-hotjar - 2 common examples

To help you get started, we’ve selected a few react-hotjar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smspillaz / intuitive-math / app / client.js View on Github external
// Import root containers
import Root from './app';

// Import analytics HOC
import analytics from './analytics';

// Import i18n messages
import { translationMessages } from './i18n';

// Observe loading of Open Sans (to remove open sans, remove the <link> tag in
// the index.html file and this observer)
const openSansObserver = new FontFaceObserver('Open Sans', {});

// Initialize hotjar with our tracking code
hotjar.initialize('793002');

// When Open Sans is loaded, add a font-family using Open Sans to the body
openSansObserver.load().then(() => {
  document.body.classList.add('fontLoaded');
}, () => {
  document.body.classList.remove('fontLoaded');
});

// Create redux store with history and hydrate state from server, if available
// eslint-disable-next-line no-underscore-dangle
const initialState = window.__SERVER_STATE || {};
const initialStateAllowedKeys = new Set(['global', 'language', 'route']);
const history = createHistory();
const store = configureStore(Object.keys(initialState).filter((k) =>
  initialStateAllowedKeys.has(k)
).reduce((acc, key) => ({
github elifesciences / elife-xpub / app / app.js View on Github external
import Routes from './routes'

const history = createHistory()
const store = configureStore(history, {})

const initializeReactGA = ({ trackingId = 'test', debug } = {}) => {
  const id = trackingId === '' ? 'test' : trackingId
  ReactGA.initialize(id, { debug })
  ReactGA.pageview('/')
}

initializeReactGA(config.googleAnalytics)

if (config.hotJar.enabled) {
  hotjar.initialize(config.hotJar.id, config.hotJar.snippetVersion)
}

const makeApolloConfig = ({ cache, link }) => {
  const clientStateLink = withClientState({
    cache,
    ...authorSchema.clientStateConfig,
  })

  return {
    cache,
    link: clientStateLink.concat(link),
    ...config,
  }
}

const App = () => (

react-hotjar

Small component to implement Hotjar into your react application

MIT
Latest version published 5 days ago

Package Health Score

80 / 100
Full package analysis

Popular react-hotjar functions