Solved

NodeJs Integration not working

  • 20 February 2020
  • 3 replies
  • 127 views

I tried using the npm package but nothing works. The code does not return response, throw error or anything at all. Also nothing appears on the dashboard.
I tried to init using verbose and debug flags. I get a message stating `Sending the following data to Mixpanel` and that’s it. No clear way to know what’s missing or why it’s not working.

icon

Best answer by stephanie 11 March 2020, 23:53

Hi @guilhermeKodama,

It looks like you might be missing some variables that also need to be set. Looking at the quick starting guide, I bolded the ones that seem to be mission below. 

// grab the Mixpanel factory

var Mixpanel = require('mixpanel');

 

// looks like you got this one!

var mixpanel = Mixpanel.init('<YOUR_TOKEN>');

 

// initialize mixpanel client configured to communicate over https

var mixpanel = Mixpanel.init('<YOUR_TOKEN>', {

    protocol: 'https'

});

 

We also just published a quick way to confirm data is being sent in node via terminal, you can take a look here

View original

3 replies

Userlevel 1
Badge

Can you share how you are triggering the .track() calls in your code?

I have exactly the same issue!

I can send events by http request but not using nodejs lib. The exactly same event with same token

 

// that doesnt work
  const mixpanel = Mixpanel.init('<TOKEN>', { debug: true })
  mixpanel.track('Signed Up', {
    distinct_id: '13794',
    'Referred By': 'Friend'
  })

Userlevel 5
Badge +4

Hi @guilhermeKodama,

It looks like you might be missing some variables that also need to be set. Looking at the quick starting guide, I bolded the ones that seem to be mission below. 

// grab the Mixpanel factory

var Mixpanel = require('mixpanel');

 

// looks like you got this one!

var mixpanel = Mixpanel.init('<YOUR_TOKEN>');

 

// initialize mixpanel client configured to communicate over https

var mixpanel = Mixpanel.init('<YOUR_TOKEN>', {

    protocol: 'https'

});

 

We also just published a quick way to confirm data is being sent in node via terminal, you can take a look here

Reply