Skip to main content

I am using standard node.js sdk to log an event with the following code:

// ES5 Syntax
const Amplitude = require('@amplitude/node');
// ES6 Syntax
import * as Amplitude from '@amplitude/node';

var client = Amplitude.init(<AMPLITUDE_API_KEY>);
client.logEvent({
event_type: 'Node.js Event',
user_id: 'datamonster@gmail.com',
location_lat: 37.77,
location_lng: -122.39,
ip: '127.0.0.1',
event_properties: {
keyString: 'valueString',
keyInt: 11,
keyBool: true
}
});

// Send any events that are currently queued for sending.
// Will automatically happen on the next event loop.
client.flush();

but though my code is already executed, it still showing listening. can some body help me out with this.

I think @Denis Holmes might help you on this one.

 


Hi @avijit_blotout! My understanding is that you’re trying to send your first event to your new Amplitude project but are not seeing the events appear.

To cover some bases, could you confirm that you’ve replaced <AMPLITUDE_API_KEY> with your project’s API key? 

Additionally, when sending the event to Amplitude, are you getting a 200 response?

Thanks!


Reply