Skip to content

Commit

Permalink
Bug 1814503 - Allow passing of utm_term through OPEN_URL and SHOW_FIR…
Browse files Browse the repository at this point in the history
…EFOX_ACCOUNT actions for Spotlight r=omc-reviewers,pdahiya

Differential Revision: https://phabricator.services.mozilla.com/D169714
  • Loading branch information
nuggetsnegin committed Feb 21, 2023
1 parent 86207e5 commit c13201b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class WelcomeScreen extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo

if (type === "SHOW_FIREFOX_ACCOUNTS") {
let params = { ..._asrouter_templates_FirstRun_addUtmParams__WEBPACK_IMPORTED_MODULE_5__.BASE_PARAMS,
utm_term: `aboutwelcome-${UTMTerm}-screen`
utm_term: `${UTMTerm}-screen`
};

if (action.addFlowParams && flowParams) {
Expand All @@ -475,7 +475,7 @@ class WelcomeScreen extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
};
} else if (type === "OPEN_URL") {
let url = new URL(data.args);
(0,_asrouter_templates_FirstRun_addUtmParams__WEBPACK_IMPORTED_MODULE_5__.addUtmParams)(url, `aboutwelcome-${UTMTerm}-screen`);
(0,_asrouter_templates_FirstRun_addUtmParams__WEBPACK_IMPORTED_MODULE_5__.addUtmParams)(url, `${UTMTerm}-screen`);

if (action.addFlowParams && flowParams) {
url.searchParams.append("device_id", flowParams.deviceId);
Expand Down Expand Up @@ -2173,14 +2173,14 @@ class AboutWelcome extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom

function ComputeTelemetryInfo(welcomeContent, experimentId, branchId) {
let messageId = welcomeContent.template === "return_to_amo" ? `RTAMO_DEFAULT_WELCOME_${welcomeContent.type.toUpperCase()}` : "DEFAULT_ID";
let UTMTerm = "default";
let UTMTerm = "aboutwelcome-default";

if (welcomeContent.id) {
messageId = welcomeContent.id.toUpperCase();
}

if (experimentId && branchId) {
UTMTerm = `${experimentId}-${branchId}`.toLowerCase();
UTMTerm = `aboutwelcome-${experimentId}-${branchId}`.toLowerCase();
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ function ComputeTelemetryInfo(welcomeContent, experimentId, branchId) {
welcomeContent.template === "return_to_amo"
? `RTAMO_DEFAULT_WELCOME_${welcomeContent.type.toUpperCase()}`
: "DEFAULT_ID";
let UTMTerm = "default";
let UTMTerm = "aboutwelcome-default";

if (welcomeContent.id) {
messageId = welcomeContent.id.toUpperCase();
}

if (experimentId && branchId) {
UTMTerm = `${experimentId}-${branchId}`.toLowerCase();
UTMTerm = `aboutwelcome-${experimentId}-${branchId}`.toLowerCase();
}
return {
messageId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class WelcomeScreen extends React.PureComponent {
if (type === "SHOW_FIREFOX_ACCOUNTS") {
let params = {
...BASE_PARAMS,
utm_term: `aboutwelcome-${UTMTerm}-screen`,
utm_term: `${UTMTerm}-screen`,
};
if (action.addFlowParams && flowParams) {
params = {
Expand All @@ -325,7 +325,7 @@ export class WelcomeScreen extends React.PureComponent {
data = { ...data, extraParams: params };
} else if (type === "OPEN_URL") {
let url = new URL(data.args);
addUtmParams(url, `aboutwelcome-${UTMTerm}-screen`);
addUtmParams(url, `${UTMTerm}-screen`);
if (action.addFlowParams && flowParams) {
url.searchParams.append("device_id", flowParams.deviceId);
url.searchParams.append("flow_id", flowParams.flowId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ add_task(async function test_multistage_aboutwelcome_utm_term() {

Assert.equal(
actionCall.args[1].data.args,
"https://www.mozilla.org/?utm_source=activity-stream&utm_campaign=firstrun&utm_medium=referral&utm_term=aboutwelcome-test-screen",
"https://www.mozilla.org/?utm_source=activity-stream&utm_campaign=firstrun&utm_medium=referral&utm_term=test-screen",
"UTMTerm set in mobile"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ describe("MultiStageAboutWelcome module", () => {
utm_campaign: "firstrun",
utm_medium: "referral",
utm_source: "activity-stream",
utm_term: "aboutwelcome-you_tee_emm-screen",
utm_term: "you_tee_emm-screen",
},
},
type: "SHOW_FIREFOX_ACCOUNTS",
Expand Down

0 comments on commit c13201b

Please sign in to comment.