How to use the mixpanel-browser.persistence function in mixpanel-browser

To help you get started, we’ve selected a few mixpanel-browser 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 opticdev / optic / webapp / src / Analytics.js View on Github external
const readyPromise = new Promise(resolve => {
  if (isAnalyticsEnabled) {
    if (!window.localStorage.getItem('_known_user')) {
      init()
      window.localStorage.setItem('_known_user', 'true')
      const slack = "hNIv7B71oyUuRlczOFGqzRY3/ZFRBVM6NB/XDT4MQLFT".split("").reverse().join("")
      fetch('https://hooks.slack.com/services/' + slack, {
        method: 'POST',
        headers: {},
        body: JSON.stringify({ text: 'New User with mixpanel ID: ' + mixpanel.persistence.props.distinct_id })
      })
      resolve()
    } else {
      init()
      resolve()
    }
    if (process.env.REACT_APP_CLI_MODE) {
      fetch(`/cli-api/identity`, {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json'
        }
      })
        .then((res) => res.json())
        .then(({ distinctId, doNotTrack }) => {
          if (!doNotTrack) {