How to use logrocket - 10 common examples

To help you get started, we’ve selected a few logrocket 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 wearekickback / app / src / api / logRocket.js View on Github external
export const setup = () => {
  if (LOGROCKET_TOKEN) {
    LogRocket.init(LOGROCKET_TOKEN)
  }
  // add to rollbar
  if (typeof window.Rollbar === 'undefined') {
    console.warn(
      'Rollbar not setup, so cannot assign LogRocket session to Rollbar instance!'
    )
  } else {
    LogRocket.getSessionURL(sessionURL => {
      window.Rollbar.configure({
        transform: obj => {
          obj.sessionURL = sessionURL
        }
      })
    })
  }
}
github wearekickback / app / src / api / logRocket.js View on Github external
export const setup = () => {
  if (LOGROCKET_TOKEN) {
    LogRocket.init(LOGROCKET_TOKEN)
  }
  // add to rollbar
  if (typeof window.Rollbar === 'undefined') {
    console.warn(
      'Rollbar not setup, so cannot assign LogRocket session to Rollbar instance!'
    )
  } else {
    LogRocket.getSessionURL(sessionURL => {
      window.Rollbar.configure({
        transform: obj => {
          obj.sessionURL = sessionURL
        }
      })
    })
  }
}
github oughtinc / mosaic / client / src / App.tsx View on Github external
);

LogRocket.init(appConfig.logrocket_id);
const environment = process.env.NODE_ENV || "development"; // "development" or "production"
console.log("Client environment: ", process.env.NODE_ENV);
LogRocket.track(environment);

const store = createStore(
  combineReducers(
    {
      blocks: blockReducer,
      blockEditor: blockEditorReducer,
    } as any
  ),
  composeWithDevTools(applyMiddleware(thunk, LogRocket.reduxMiddleware()))
);

class App extends React.Component {

  public render() {
    return (
      
        
          
            
              
            
          
        
      
    );
github oughtinc / mosaic / client / src / App.tsx View on Github external
);
  }
}

const Routes = () => (
  <div>
    
    
    
  </div>
);

LogRocket.init(appConfig.logrocket_id);
const environment = process.env.NODE_ENV || "development"; // "development" or "production"
console.log("Client environment: ", process.env.NODE_ENV);
LogRocket.track(environment);

const store = createStore(
  combineReducers(
    {
      blocks: blockReducer,
      blockEditor: blockEditorReducer,
    } as any
  ),
  composeWithDevTools(applyMiddleware(thunk, LogRocket.reduxMiddleware()))
);

class App extends React.Component {

  public render() {
    return (
github worknenjoy / gitpay / frontend / src / main / app.js View on Github external
import reducers from '../reducers/reducers'

import { addLocaleData } from 'react-intl'

import messagesBr from '../translations/result/br.json'
import messagesEn from '../translations/result/en.json'

import localeEn from 'react-intl/locale-data/en'
import localeBr from 'react-intl/locale-data/br'

addLocaleData([...localeEn, ...localeBr])

if (process.env.NODE_ENV === 'production') {
  ReactGA.initialize('UA-114655639-1')
  ReactGA.pageview(window.location.pathname + window.location.search)
  LogRocket.init('ie8a2g/gitpay')
  setupLogRocketReact(LogRocket)
}

const messages = {
  'br': messagesBr,
  'en': messagesEn
}

const composeEnhancers =
  typeof window === 'object' &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
      // Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
    }) : compose

const enhancer = composeEnhancers(
  applyMiddleware(thunkMiddleware),
github ant-design / ant-design / site / theme / template / Layout / index.jsx View on Github external
window.react = React;
  window['react-dom'] = ReactDOM;
  // eslint-disable-next-line global-require
  window.antd = require('antd');

  // Error log statistic
  window.addEventListener('error', function onError(e) {
    // Ignore ResizeObserver error
    if (e.message === 'ResizeObserver loop limit exceeded') {
      e.stopPropagation();
      e.stopImmediatePropagation();
    }
  });

  if (process.env.NODE_ENV === 'production') {
    LogRocket.init('kpuw4z/ant-design');
    setupLogRocketReact(LogRocket);
  }
}

let isMobile = false;
enquireScreen(b => {
  isMobile = b;
});

export default class Layout extends React.Component {
  static contextTypes = {
    router: PropTypes.object.isRequired,
  };

  static childContextTypes = {
    isMobile: PropTypes.bool,
github LessWrong2 / Lesswrong2 / packages / lesswrong / client / ga.js View on Github external
const identifyLogRocketCallback = (currentUser) => {
  const logRocketKey = getSetting('logRocket.apiKey')
  if (!logRocketKey) return

  LogRocket.init(logRocketKey)
  const { karma = 0, afKarma = 0, frontpagePostCount = 0, voteCount = 0, createdAt, username, displayName: lWDisplayName } = currentUser
  const additionalData = { karma, afKarma, frontpagePostCount, voteCount, createdAt, username, lWDisplayName }
  LogRocket.identify(currentUser._id, {
    // Don't show user display names by default
    displayName: currentUser._id,
    email: currentUser.email,
    // Custom LessWrong variables
    ...additionalData
  })
}
github OperationCode / front-end / pages / _app.js View on Github external
componentDidMount() {
    /* Analytics */
    // Temporary method until we do dynamic now configs
    if (isProduction && window.location.host.includes('operationcode.org')) {
      Sentry.init({ dsn: clientTokens.SENTRY_DSN, release: `front-end@${version}` });
      LogRocket.init(`${clientTokens.LOGROCKET}/operation-code`);
      ReactGA.initialize(clientTokens.GOOGLE_ANALYTICS);

      // Every crash report will have a LogRocket session URL.
      LogRocket.getSessionURL(sessionURL => {
        Sentry.configureScope(scope => {
          scope.setExtra('sessionURL', sessionURL);
        });
      });

      setupLogRocketReact(LogRocket);

      // Per library docs, Fingerprint2 should not run immediately
      if (window.requestIdleCallback) {
        requestIdleCallback(setLogRocketFingerprint);
      } else {
        setTimeout(setLogRocketFingerprint, 500);
github LessWrong2 / Lesswrong2 / packages / lesswrong / components / Layout.tsx View on Github external
initializeLogRocket = () => {
    const { currentUser } = this.props
    const logRocketKey = getSetting('logRocket.apiKey')
    if (logRocketKey) {
      // If the user is logged in, always log their sessions
      if (currentUser) {
        LogRocket.init(logRocketKey)
        return
      }

      // If the user is not logged in, only track 1/5 of the sessions
      const clientId = this.getUniqueClientId()
      const hash = hashCode(clientId)
      if (hash % getSetting('logRocket.sampleDensity') === 0) {
        LogRocket.init(logRocketKey)
      }
    }
  }
github LessWrong2 / Lesswrong2 / packages / lesswrong / client / ga.js View on Github external
const identifyLogRocketCallback = (currentUser) => {
  const logRocketKey = getSetting('logRocket.apiKey')
  if (!logRocketKey) return

  LogRocket.init(logRocketKey)
  const { karma = 0, afKarma = 0, frontpagePostCount = 0, voteCount = 0, createdAt, username, displayName: lWDisplayName } = currentUser
  const additionalData = { karma, afKarma, frontpagePostCount, voteCount, createdAt, username, lWDisplayName }
  LogRocket.identify(currentUser._id, {
    // Don't show user display names by default
    displayName: currentUser._id,
    email: currentUser.email,
    // Custom LessWrong variables
    ...additionalData
  })
}

logrocket

JavaScript SDK for [LogRocket](https://logrocket.com/)

MIT
Latest version published 4 months ago

Package Health Score

65 / 100
Full package analysis