How to use the mixpanel-browser.identify 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 studentinsights / studentinsights / app / assets / javascripts / helpers / MixpanelUtils.js View on Github external
registerUser(currentEducator) {
    try {
      if (!isEnabled()) return;
      mixpanel.init(readEnv().mixpanelToken);
      mixpanel.set_config({
        track_pageview: true,
        secure_cookie: true,
        cross_subdomain_cookie: false // https://help.mixpanel.com/hc/en-us/articles/115004507486-Track-Across-Hosted-Subdomains
      });
      mixpanel.identify(currentEducator.id);
      mixpanel.register({
        'deployment_key': readEnv().deploymentKey,
        'district_key': readEnv().districtKey,
        'educator_id': currentEducator.id,
        'educator_is_admin': currentEducator.admin,
        'educator_school_id': currentEducator.school_id
      });
    }
    catch (err) {
      console.error(err); // eslint-disable-line no-console
    }
  },
github opticdev / optic / webapp / src / Analytics.js View on Github external
.then(({ distinctId, doNotTrack }) => {
          if (!doNotTrack) {
            init()
            mixpanel.identify(distinctId)
            if (window.FS) {
              window.FS.identify(distinctId);
              window.FS.identify(distinctId);
            }
            track('Opened on Local')
          } else {
            if (window.FS) {
              window.FS.shutdown()
            }

            isAnalyticsEnabled = false
          }
          resolve()
        });
    }
github mapseed / platform / src / base / static / utils / mixpanel.js View on Github external
identify: id => {
    if (envCheck) mixpanel.identify(id);
  },
  alias: id => {
github streamlit / streamlit / frontend / src / lib / remotetracking.ts View on Github external
export function initRemoteTracker({gatherUsageStats, email}: {gatherUsageStats?: boolean; email?: string}): void {
  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()
    }
  }
}
github Lumeer / web-ui / src / app / core / guards / current-user.guard.ts View on Github external
map(user => {
        if (!user.agreement) {
          this.authService.saveLoginRedirectPath(state.url);
          this.router.navigate(['/', 'agreement']);

          if (environment.analytics && environment.mixpanelKey) {
            const userHash = hashUserId(user.id);
            mixpanel.alias(userHash);
            mixpanel.identify(userHash);
          }
        } else {
          if (environment.analytics && environment.mixpanelKey) {
            const userHash = hashUserId(user.id);
            mixpanel.identify(userHash);
          }
        }

        return user.agreement;
      })
    );
github web-pal / chronos-timetracker / app / renderer / sagas / initialize.js View on Github external
function identifyInSentryAndMixpanel(host: string, userData: any): void {
  if (process.env.DISABLE_MIXPANEL !== '1') {
    mixpanel.identify((`${host} - ${userData.emailAddress}`));
    mixpanel.people.set({
      host,
      version,
      locale: userData.locale,
      $timezone: userData.timeZone,
      $name: userData.displayName,
      $email: userData.emailAddress,
      $distinct_id: `${host} - ${userData.emailAddress}`,
    });
    Sentry.configureScope((scope) => {
      scope.setUser({
        host,
        locale: userData.locale,
        timeZone: userData.timeZone,
        name: userData.displayName,
        email: userData.emailAddress,
github daostack / alchemy / src / lib / analytics.ts View on Github external
identify: (id: string) => {
    if (doTracking) { Mixpanel.identify(id); }
  },
  alias: (id: string) => {
github web-pal / chronos-timetracker / app / sagas / profile.js View on Github external
function identifyInSentryAndMixpanel(host: URL, userData: User): void {
  if (process.env.DISABLE_MIXPANEL !== '1') {
    mixpanel.identify((`${host.origin} - ${userData.emailAddress}`));
    mixpanel.people.set({
      host: host.origin,
      locale: userData.locale,
      $timezone: userData.timeZone,
      $name: userData.displayName,
      $email: userData.emailAddress,
      $distinct_id: `${host.origin} - ${userData.emailAddress}`,
    });
    Raven.setUserContext({
      host: host.origin,
      locale: userData.locale,
      timeZone: userData.timeZone,
      name: userData.displayName,
      email: userData.emailAddress,
    });
  }