How to use the mixpanel-browser.init 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 joshwcomeau / guppy / src / services / analytics.service.js View on Github external
export const createLogger = (environment?: ?string = process.env.NODE_ENV) => {
  mixpanel.init(MIXPANEL_KEY);

  // Every user is given a distinct ID so that we can track return visits.
  // Because electron doesn't persist cookies, we have to do this ourselves.
  let distinctId = electronStore.get(DISTINCT_ID_KEY);
  if (!distinctId) {
    distinctId = uuid();
    electronStore.set(DISTINCT_ID_KEY, distinctId);
  }

  mixpanel.identify(distinctId);

  return {
    logEvent: (event: EventType, data: any) => {
      if (environment !== 'production') {
        console.info('Event tracked', event, data);
        return;
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 rodi01 / RenameIt / resources / views / components / findReplaceLayer / index.jsx View on Github external
replaceFocus: false,
      previewData: [],
      searchScope: this.hasSelection > 0 ? "layers" : "page"
    }
    this.findReplace = new FindReplace()
    this.enterFunction = this.enterFunction.bind(this)
    this.onSubmit = this.onSubmit.bind(this)
    this.onCaseSensitiveChange = this.onCaseSensitiveChange.bind(this)
    this.handleFindHistory = this.handleFindHistory.bind(this)
    this.handleRadioSelection = this.handleRadioSelection.bind(this)
    this.handleReplaceHistory = this.handleReplaceHistory.bind(this)
    this.onChange = this.onChange.bind(this)
    this.clearInput = this.clearInput.bind(this)

    // Tracking
    mixpanel.init(mixpanelId)
  }
github pubpub / pubpub / src / client.js View on Github external
import { useRouterHistory } from 'react-router';

import createStore from './createStore';
import ApiClient from './helpers/ApiClient';
// import io from 'socket.io-client';
import {Provider} from 'react-redux';
import {reduxReactRouter, ReduxRouter} from 'redux-router';
import match from 'react-router/lib/match';

import getRoutes from './routes';
import makeRouteHooksSafe from './helpers/makeRouteHooksSafe';

import ga from 'react-ga';
import mixpanel from 'mixpanel-browser';
ga.initialize('UA-61723493-3');
mixpanel.init('f85adcbd0f97f6101ebd440e931197b2');

const client = new ApiClient();
import Html from './helpers/Html';

const appHistory = useScroll(useRouterHistory(createBrowserHistory))();

const newHistory = () => appHistory;

const dest = document.getElementById('content');
const store = createStore(reduxReactRouter, makeRouteHooksSafe(getRoutes), newHistory, client, window.__INITIAL_STATE__);

const routes = getRoutes(store, history);
const component = (
github joshwcomeau / tinkersynth / src / helpers / analytics.helpers.js View on Github external
export const createLogger = (environment?: ?string = process.env.NODE_ENV) => {
  mixpanel.init(MIXPANEL_KEY);

  let distinctId = getDistinctId();

  mixpanel.identify(distinctId);

  return {
    logEvent: (event: EventType, data: any) => {
      if (environment !== 'production') {
        console.info('Event tracked', event, data);
        return;
      }

      mixpanel.track(event, data);
    },
  };
};
github Broaden-io / Broaden-io-client / src / components / SignUp.js View on Github external
componentDidMount() {
    mixpanel.init('333f6269317ae9b78a29c535e29f00bf')
    mixpanel.track("Login Page");
  }
github squadlytics / docs-as-code-starterkit / src / templates / docs-template.js View on Github external
componentDidMount() {
    const { markdownRemark: page } = this.props.data;
    if (process.env.GATSBY_MIXPANEL_KEY) {
      mixpanel.init(process.env.GATSBY_MIXPANEL_KEY)
      mixpanel.track(`docs.view:${page.frontmatter.title}`)
    }
  }
github Broaden-io / Broaden-io-client / src / components / MyRoadmaps.js View on Github external
componentDidMount() {
    mixpanel.init('333f6269317ae9b78a29c535e29f00bf')
    mixpanel.track("Rubrics Index Component Page");
  }
github nickpwhite / Beatnik / reactjs / src / App.js View on Github external
constructor(props) {
    super(props);

    const tracking = localStorage.getItem("tracking") === "true";
    mixpanel.init(process.env.REACT_APP_MIXPANEL_TOKEN, { opt_out_tracking_by_default: !tracking });

    this.closeModal = this.closeModal.bind(this);
    this.handleModalNo = this.handleModalNo.bind(this);
    this.handleModalYes = this.handleModalYes.bind(this);

    this.state = {
      modalOpen: localStorage.getItem("tracking") === null
    };
  }
github Broaden-io / Broaden-io-client / src / components / Profile.js View on Github external
componentDidMount() {
    mixpanel.init('333f6269317ae9b78a29c535e29f00bf')
    mixpanel.track("Profile Page");
  }