Mixpanel analytics confusion

Hi,

Have been messing around with mixpanel analytics but no success. I just want to collect one data property from a create data record.

They have javascript and node.js, which one works in appgyver javascript? (I have tried both example codes with my project token but still not working).

Node.js:

var Mixpanel = require(‘mixpanel’);
var mixpanel = Mixpanel.init(’<YOUR_TOKEN>’);

// track an event with optional properties
mixpanel.track(‘event name’, {
distinct_id: ‘unique client id’,
property_1: ‘value 1’,
property_2: ‘value 2’,
property_3: ‘value 3’
});

javascript:

npm install --save mixpanel-browser (or yarn?)

import mixpanel from ‘mixpanel-browser’;
// or with require() syntax:
// const mixpanel = require(‘mixpanel-browser’);

mixpanel.init(‘YOUR_TOKEN’);
mixpanel.track(‘Sign up’);

there is also a html version.

If anyone has used mixpanel before could help or could just give the code that would be great.

Mixpanel link: JavaScript

Thanks

1 Like

So as far as I understand I:

  1. call up mixpanel (import). I have shown both that work.
  2. Set my project token for mixpanel. (init)
  3. Set (var) and (return) the result (input1)
  4. (track) with mixpanel. (labelled as “print”)

My project token is not initiating though. I am using the react native language. Is this right?

Page I’m getting info from: JSDoc: Home

Any help is greatly appreciated. Thanks :slight_smile:

P.S.
I have tried the google analytics code that is in the forums here but that didn’t work and I don’t really like Google analytics. This is the last part of my app that I want to add. It’s actually for research not market research.

Thanks