How to use the mixpanel-browser.opt_out_tracking 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 pingcap / tidb-dashboard / ui / lib / utils / telemetry.ts View on Github external
batch_requests: true,
    persistence: 'localStorage',
    property_blacklist: [
      '$initial_referrer',
      '$initial_referring_domain',
      '$referrer',
      '$referring_domain',
    ],
  }
  const apiHost = process.env.REACT_APP_MIXPANEL_HOST
  if (apiHost) {
    options['api_host'] = apiHost
  }
  mixpanel.init(token, options)
  // disable mixpanel to report data immediately
  mixpanel.opt_out_tracking()
  if (info?.disable_telemetry === false) {
    mixpanel.register({
      $current_url: getPathInLocationHash(),
    })
    mixpanel.opt_in_tracking()
  }
}
github streamlit / streamlit / frontend / src / lib / remotetracking.ts View on Github external
if (gatherUsageStats != null) {
    trackUsage = gatherUsageStats
  }

  if (trackUsage) {
    mixpanel.identify(INSTALLATION_ID)
    if (email) {
      logMessage(`Email: ${email}`)
      mixpanel.people.set({
        '$email': email,
        '$created': new Date().toISOString(),
      })
    }
    mixpanel.opt_in_tracking()
  } else {
    mixpanel.opt_out_tracking()
  }

  logAlways('Track stats remotely: ', trackUsage)

  preInitializationEventQueue.forEach(([eventName, opts]) => {
    trackEventRemotely(eventName, opts)
  })
}
github Opentrons / opentrons / app / src / analytics / mixpanel.js View on Github external
export function setMixpanelTracking(config: AnalyticsConfig) {
  if (MIXPANEL_ID) {
    if (config.optedIn) {
      log.debug('User has opted into analytics; tracking with Mixpanel')
      mixpanel.identify(config.appId)
      mixpanel.opt_in_tracking()
      mixpanel.register({ appVersion: CURRENT_VERSION, appId: config.appId })
    } else {
      log.debug('User has opted out of analytics; stopping tracking')
      mixpanel.opt_out_tracking()
      mixpanel.reset()
    }
  }
}