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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.signUp = function (email, password, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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] * @param {String} [options.unblockCode]
* Login unblock code. * Login unblock code.
* @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request * @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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.passwordForgotSendCode = function(email, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.passwordForgotResendCode = function(email, passwordForgotToken, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.passwordForgotVerifyCode = function(code, passwordForgotToken, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.accountReset = function(email, newPassword, accountResetToken, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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 * @return {Promise} A promise that will be fulfilled with JSON `xhr.responseText` of the request
*/ */
FxAccountClient.prototype.sendUnblockCode = function (email, options) { 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.deviceId identifier for the current device
* @param {String} options.metricsContext.flowId identifier for the current event flow * @param {String} options.metricsContext.flowId identifier for the current event flow
* @param {Number} options.metricsContext.flowBeginTime flow.begin event time * @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) { FxAccountClient.prototype.sendSms = function (sessionToken, phoneNumber, messageId, options) {
var request = this.request; var request = this.request;

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

@ -13,7 +13,12 @@ define([], function () {
return { return {
deviceId: data.deviceId, deviceId: data.deviceId,
flowId: data.flowId, 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: { metricsContext: {
deviceId: '0123456789abcdef0123456789abcdef', deviceId: '0123456789abcdef0123456789abcdef',
flowBeginTime: 1480615985437, flowBeginTime: 1480615985437,
flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
utmCampaign: 'mock-campaign',
utmContent: 'mock-content',
utmMedium: 'mock-medium',
utmSource: 'mock-source',
utmTerm: 'mock-term'
}, },
sessionToken: true sessionToken: true
}), RequestMocks.accountReset); }), RequestMocks.accountReset);

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

@ -35,7 +35,12 @@ define([
assert.deepEqual(metricsContext.marshall(input), { assert.deepEqual(metricsContext.marshall(input), {
deviceId: input.deviceId, deviceId: input.deviceId,
flowBeginTime: input.flowBeginTime, 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', deviceId: '0123456789abcdef0123456789abcdef',
flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', flowId: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
flowBeginTime: Date.now(), flowBeginTime: Date.now(),
utmCampaign: 'mock-campaign',
utmContent: 'mock-content',
utmMedium: 'mock-medium',
utmSource: 'mock-source',
utmTerm: 'mock-term',
forbiddenProperty: 666 forbiddenProperty: 666
} }
}), }),