analytics-client
Advanced tools
Comparing version 0.9.0 to 0.9.1-roman-fix-experiment-87fa997230e79f7506b69b9dab0d016c81200923
@@ -7,2 +7,7 @@ # Change Log | ||
# v0.9.1 | ||
## (2020-06-17) | ||
* Fix duplicate experiment values [Roman Mazur] | ||
# v0.9.0 | ||
@@ -9,0 +14,0 @@ ## (2020-06-12) |
{ | ||
"name": "analytics-client", | ||
"version": "0.9.0", | ||
"version": "0.9.1-roman-fix-experiment-87fa997230e79f7506b69b9dab0d016c81200923", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -14,2 +14,3 @@ import { Client } from './client'; | ||
private static dataString; | ||
private static amplitudePreInsert; | ||
private identify; | ||
@@ -16,0 +17,0 @@ define(variation: Variation, targetPercent: number): LocalExperiment<Variation>; |
@@ -29,2 +29,6 @@ "use strict"; | ||
}; | ||
LocalExperiment.amplitudePreInsert = function (identify, name, value) { | ||
identify._addOperation('$preInsert', name, value); | ||
return identify; | ||
}; | ||
LocalExperiment.prototype.identify = function (result) { | ||
@@ -34,3 +38,3 @@ if (this.analytics != null) { | ||
.amplitude() | ||
.identify(new amplitude_js_1.Identify().append('Experiments', this.name + "_" + result)); | ||
.identify(LocalExperiment.amplitudePreInsert(new amplitude_js_1.Identify(), 'Experiments', this.name + "_" + result)); | ||
} | ||
@@ -37,0 +41,0 @@ }; |
{ | ||
"name": "analytics-client", | ||
"version": "0.9.0", | ||
"version": "0.9.1-roman-fix-experiment-87fa997230e79f7506b69b9dab0d016c81200923", | ||
"description": "Convenient builders to compose analytics tools", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -51,2 +51,13 @@ import { Identify } from 'amplitude-js'; | ||
private static amplitudePreInsert( | ||
identify: Identify, | ||
name: string, | ||
value: string, | ||
): Identify { | ||
// XXX: $preInsert is documented but not exposed in the JS SDK. | ||
// https://help.amplitude.com/hc/en-us/articles/205406617#keys-for-the-identification-argument | ||
(identify as any)._addOperation('$preInsert', name, value); | ||
return identify; | ||
} | ||
private identify(result: Variation) { | ||
@@ -57,3 +68,7 @@ if (this.analytics != null) { | ||
.identify( | ||
new Identify().append('Experiments', `${this.name}_${result}`), | ||
LocalExperiment.amplitudePreInsert( | ||
new Identify(), | ||
'Experiments', | ||
`${this.name}_${result}`, | ||
), | ||
); | ||
@@ -60,0 +75,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
261584
1788