feat(api): add utm params to the metrics context (#262), r=@vbudhram

This commit is contained in:
Phil Booth 2017-09-21 13:33:06 +01:00 коммит произвёл Vijay Budhram
Родитель 307d42831a
Коммит 4b019f81be
5 изменённых файлов: 63 добавлений и 3 удалений

Просмотреть файл

@ -97,6 +97,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.signUp = function (email, password, options) {
@ -189,6 +194,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @param {String} [options.unblockCode]
* Login unblock code.
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
@ -418,6 +428,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.passwordForgotSendCode = function(email, options) {
@ -481,6 +496,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.passwordForgotResendCode = function(email, passwordForgotToken, options) {
@ -538,6 +558,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.passwordForgotVerifyCode = function(code, passwordForgotToken, options) {
@ -603,6 +628,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.accountReset = function(email, newPassword, accountResetToken, options) {
@ -1249,6 +1279,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/
FxAccountClient.prototype.sendUnblockCode = function (email, options) {
@ -1310,6 +1345,11 @@ define([
* @param {String} options.metricsContext.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time
* @param {Number} options.metricsContext.utmCampaign marketing campaign identifier
* @param {Number} options.metricsContext.utmContent content identifier
* @param {Number} options.metricsContext.utmMedium acquisition medium
* @param {Number} options.metricsContext.utmSource traffic source
* @param {Number} options.metricsContext.utmTerm search terms
*/
FxAccountClient.prototype.sendSms = function (sessionToken, phoneNumber, messageId, options) {
var request = this.request;

Просмотреть файл

@ -13,7 +13,12 @@ define([], function () {
return {
deviceId: data.deviceId,
flowId: data.flowId,
flowBeginTime: data.flowBeginTime
flowBeginTime: data.flowBeginTime,
utmCampaign: data.utmCampaign,
utmContent: data.utmContent,
utmMedium: data.utmMedium,
utmSource: data.utmSource,
utmTerm: data.utmTerm
};
}
};

Просмотреть файл

@ -158,7 +158,12 @@ define([
metricsContext: {
deviceId: '0123456789abcdef0123456789abcdef',
flowBeginTime: 1480615985437,
flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
utmCampaign: 'mock-campaign',
utmContent: 'mock-content',
utmMedium: 'mock-medium',
utmSource: 'mock-source',
utmTerm: 'mock-term'
},
sessionToken: true
}), RequestMocks.accountReset);

Просмотреть файл

@ -35,7 +35,12 @@ define([
assert.deepEqual(metricsContext.marshall(input), {
deviceId: input.deviceId,
flowBeginTime: input.flowBeginTime,
flowId: input.flowId
flowId: input.flowId,
utmCampaign: 'foo',
utmContent: 'bar',
utmMedium: 'baz',
utmSource: 'qux',
utmTerm: 'wibble'
});
});
});

Просмотреть файл

@ -244,6 +244,11 @@ define([
deviceId: '0123456789abcdef0123456789abcdef',
flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
flowBeginTime: Date.now(),
utmCampaign: 'mock-campaign',
utmContent: 'mock-content',
utmMedium: 'mock-medium',
utmSource: 'mock-source',
utmTerm: 'mock-term',
forbiddenProperty: 666
}
}),