Support for geolocation and library version property
The configuration option geolocate
can be used to take advantage of Mixpanel's automatic geolocation properties (converting the source IP address into properties for country/region/city). This is generally useful when the NodeJS SDK is used in a client application, such as an Electron app or IoT device; whereas in a server application (e.g. an Express application server), the IP address will be that of the server rather than the user. To turn on geolocation, initialize the library with geolocate: true
:
const mixpanel = Mixpanel.init('<YOUR_TOKEN>', {
geolocate: true,
});
The SDK also now sends the current library version as a property with every event, like Mixpanel's other SDKs.