amplitude
Advanced tools
Comparing version 5.1.5 to 5.1.6
# Amplitude Change Log | ||
## v5.1.6 | ||
- Security update for `lodash` | ||
## v5.1.5 | ||
@@ -4,0 +7,0 @@ - Security update for `y18n` |
{ | ||
"name": "amplitude", | ||
"version": "5.1.5", | ||
"version": "5.1.6", | ||
"description": "A node wrapper for Amplitude analytics http api", | ||
@@ -83,3 +83,3 @@ "author": "Blade Barringer <blade@crookedneighbor.com>", | ||
"lint-staged": "^10.2.11", | ||
"lodash": "^4.17.19", | ||
"lodash": "^4.17.21", | ||
"mocha": "^7.2.0", | ||
@@ -86,0 +86,0 @@ "nock": "^12.0.3", |
152
README.md
@@ -8,5 +8,7 @@ # amplitude | ||
## Amplitude SSL Issue | ||
As of 2020-05-30, Amplitude reported issues with their SSL certificate, so they set up an endpoint and alternate endpoint at `https://api2.amplitude.com`. Read about it on [Amplitude's Status Page](https://status.amplitude.com/incidents/lf2pwqnyrn6s) and affected devices [here](https://calnetweb.berkeley.edu/calnet-technologists/incommon-sectigo-certificate-service/addtrust-external-root-expiration-may-2020). | ||
As of v5.1.0+, you can use the alternative endpoint by setting the environment variable: | ||
```bash | ||
@@ -17,2 +19,3 @@ AMPLITUDE_TOKEN_ENDPOINT = 'https://api2.amplitude.com' | ||
Or in the constructor: | ||
```javascript | ||
@@ -24,3 +27,4 @@ const amplitude = new Amplitude('api-token', { | ||
## Version 5+ Note ## | ||
## Version 5+ Note | ||
For amplitude@5+, it uses Amplitude's [V2 HTTP API](https://help.amplitude.com/hc/en-us/articles/360032842391-HTTP-API-V2), which replaces the deprecated [V1 HTTP API](https://help.amplitude.com/hc/en-us/articles/204771828-HTTP-API-Deprecated-). This only affects the [`.track` method](#track-an-event). The only potential breaking change is by default `user_id` and `device_id` require a minimum of 5 characters. | ||
@@ -69,2 +73,3 @@ | ||
You can also pass an array of `event` objects: | ||
```javascript | ||
@@ -95,6 +100,5 @@ const data = [ | ||
] | ||
amplitude.track(data) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude.track(data).then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
@@ -104,3 +108,3 @@ | ||
The `identify` method allows you to [make changes to a user without sending an analytics event](https://amplitude.zendesk.com/hc/en-us/articles/205406617). | ||
The `identify` method allows you to [make changes to a user without sending an analytics event](https://amplitude.zendesk.com/hc/en-us/articles/205406617). | ||
@@ -118,9 +122,9 @@ ```javascript | ||
} | ||
amplitude.identify(data) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude.identify(data).then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
You can also pass an array of `identify` objects: | ||
```javascript | ||
@@ -149,9 +153,8 @@ const data = [ | ||
] | ||
amplitude.identify(data) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude.identify(data).then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
With this method, you can also [modify user properties using property operations](https://amplitude.zendesk.com/hc/en-us/articles/205406617-Identify-API-Modify-User-Properties#keys-for-the-identification-argument). | ||
With this method, you can also [modify user properties using property operations](https://amplitude.zendesk.com/hc/en-us/articles/205406617-Identify-API-Modify-User-Properties#keys-for-the-identification-argument). | ||
@@ -174,6 +177,5 @@ ```javascript | ||
} | ||
amplitude.identify(data) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude.identify(data).then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
@@ -200,6 +202,5 @@ | ||
} | ||
amplitude.track(data) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude.track(data).then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
@@ -238,5 +239,5 @@ | ||
try { | ||
await amplitude.track({ | ||
event_type: 'some value' | ||
}) | ||
await amplitude.track({ | ||
event_type: 'some value' | ||
}) | ||
} catch (err) { | ||
@@ -248,9 +249,10 @@ console.error(err) | ||
amplitude.track({ | ||
event_type: 'some value', | ||
user_id: 'will-override-the-default-id' | ||
}) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
amplitude | ||
.track({ | ||
event_type: 'some value', | ||
user_id: 'will-override-the-default-id' | ||
}) | ||
.then(res => { | ||
console.log('Amplitude response', res) | ||
}) | ||
``` | ||
@@ -263,6 +265,8 @@ | ||
```javascript | ||
amplitude.track(data) | ||
amplitude | ||
.track(data) | ||
.then(function(result) { | ||
//... do something | ||
}).catch(function(error) { | ||
}) | ||
.catch(function(error) { | ||
//... do something | ||
@@ -273,9 +277,9 @@ }) | ||
try { | ||
const result = await amplitude.track({ | ||
event_type: 'some value' | ||
}) | ||
//... do something with result | ||
const result = await amplitude.track({ | ||
event_type: 'some value' | ||
}) | ||
//... do something with result | ||
} catch (error) { | ||
console.error(error) | ||
//... do something with the error | ||
console.error(error) | ||
//... do something with the error | ||
} | ||
@@ -298,6 +302,8 @@ ``` | ||
amplitude.export({ | ||
start: '20160501T20', | ||
end: '20160601T20' | ||
}).pipe(stream) | ||
amplitude | ||
.export({ | ||
start: '20160501T20', | ||
end: '20160601T20' | ||
}) | ||
.pipe(stream) | ||
``` | ||
@@ -335,3 +341,3 @@ | ||
amplitude.userActivity('Amplitude ID').then(function (res) { | ||
amplitude.userActivity('Amplitude ID').then(function(res) { | ||
const userData = res.userData // data about the user | ||
@@ -368,12 +374,15 @@ const events = res.events // an array of events associated with the user | ||
amplitude.userSearch('user-id').then(function (res) { | ||
// If you're using a prefix, you may get multiple matches and | ||
// you may need to handle the case where there is not a match | ||
const match = res.matches[0] | ||
amplitude | ||
.userSearch('user-id') | ||
.then(function(res) { | ||
// If you're using a prefix, you may get multiple matches and | ||
// you may need to handle the case where there is not a match | ||
const match = res.matches[0] | ||
return amplitude.userActivity(match.amplitude_id) | ||
}).then(function (res) { | ||
const userData = res.userData // data about the user | ||
const events = res.events // an array of events associated with the user | ||
}) | ||
return amplitude.userActivity(match.amplitude_id) | ||
}) | ||
.then(function(res) { | ||
const userData = res.userData // data about the user | ||
const events = res.events // an array of events associated with the user | ||
}) | ||
``` | ||
@@ -390,12 +399,13 @@ | ||
amplitude.eventSegmentation({ | ||
e: { | ||
'event_type': 'event_name' | ||
}, | ||
start: '20170104', | ||
end: '20170117', | ||
}) | ||
.then((res) => { | ||
const segmentationData = res.data | ||
}) | ||
amplitude | ||
.eventSegmentation({ | ||
e: { | ||
event_type: 'event_name' | ||
}, | ||
start: '20170104', | ||
end: '20170117' | ||
}) | ||
.then(res => { | ||
const segmentationData = res.data | ||
}) | ||
``` | ||
@@ -408,3 +418,3 @@ | ||
seriesLabels: [ 0 ], | ||
xValues: | ||
xValues: | ||
[ '2017-01-04', | ||
@@ -438,6 +448,6 @@ '2017-01-05', | ||
+ [Erki Esken](http://deekit.net/) | ||
+ [Matthew Keesan](http://keesan.net) | ||
+ [Geoff Dutton](https://github.com/geoffdutton) | ||
+ Matt Pardee | ||
+ [Chase Seibert](http://chase-seibert.github.io/blog/) | ||
- [Erki Esken](http://deekit.net/) | ||
- [Matthew Keesan](http://keesan.net) | ||
- [Geoff Dutton](https://github.com/geoffdutton) | ||
- Matt Pardee | ||
- [Chase Seibert](http://chase-seibert.github.io/blog/) |
45282
434