This obviously results in the error "ReferenceError: amplitude is not defined"
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();```
From https://developers.amplitude.com/docs/nodejs you can see that "Amplitude" is caps in one place but lowercase in "amplitude.init()"
This obviously results in the error "ReferenceError: amplitude is not defined"