amplitude / Amplitude-Node

Server-side Node.js SDK for Amplitude
MIT License
67 stars 20 forks source link

Node.js example has a bug for ES5 #132

Closed andrewchou closed 3 years ago

andrewchou commented 3 years ago

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"


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();```
ajhorst commented 3 years ago

@andrewchou thanks for reporting this typo! It has been fixed in the documentation