Skip to content

Commit 6694318

Browse files
authored
Add UTM Params for Bundle Onboarding links (#5910)
* add utm params * update tests
1 parent ea45f72 commit 6694318

File tree

3 files changed

+57
-12
lines changed

3 files changed

+57
-12
lines changed

src/app/(bundle)/bundle/onboarding/BundleOnboardingView.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
.gradientTextFill {
1616
background: linear-gradient(
17-
180deg,
18-
tokens.$color-blue-30 30%,
19-
tokens.$color-purple-40 100%
17+
45deg,
18+
tokens.$color-purple-50 20%,
19+
tokens.$color-blue-30 100%
2020
);
2121
// src: https://www.geeksforgeeks.org/how-to-create-linear-gradient-text-using-html-and-css/
2222
-webkit-background-clip: text;

src/app/(bundle)/bundle/onboarding/BundleOnboardingView.test.tsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import { useTelemetry } from "../../../hooks/useTelemetry";
1010
import userEvent from "@testing-library/user-event";
1111
import FooterMeta, { BundleFooterDefault } from "./BundleFooter.stories";
1212
import HeaderMeta, { BundleHeaderDefault } from "./BundleHeader.stories";
13+
import {
14+
bundleQueryParamsExternalProducts,
15+
bundleQueryParamsMonitor,
16+
promptNoneAuthParams,
17+
} from "./BundleOnboardingView";
1318

1419
jest.mock("../../../hooks/useTelemetry");
1520

@@ -65,7 +70,10 @@ it("opens a new tab when cta is selected", async () => {
6570
render(<ComposedBundlePage />);
6671

6772
const monitorLink = screen.getByRole("link", { name: "Go to ⁨Monitor⁩" });
68-
expect(monitorLink).toHaveAttribute("href", "/user/dashboard");
73+
expect(monitorLink).toHaveAttribute(
74+
"href",
75+
"/user/dashboard?" + `${bundleQueryParamsMonitor}`,
76+
);
6977

7078
await user.click(monitorLink);
7179

@@ -75,7 +83,11 @@ it("opens a new tab when cta is selected", async () => {
7583
jest.spyOn(console, "error").mockImplementationOnce(() => undefined);
7684

7785
const vpnLink = screen.getByRole("link", { name: "Get ⁨VPN⁩" });
78-
expect(vpnLink).toHaveAttribute("href", process.env.MOZILLA_VPN_LANDING_URL);
86+
const vpnHref =
87+
process.env.MOZILLA_VPN_LANDING_URL +
88+
"/download?" +
89+
bundleQueryParamsExternalProducts;
90+
expect(vpnLink).toHaveAttribute("href", vpnHref);
7991

8092
await user.click(vpnLink);
8193

@@ -85,10 +97,15 @@ it("opens a new tab when cta is selected", async () => {
8597
jest.spyOn(console, "error").mockImplementationOnce(() => undefined);
8698

8799
const relayLink = screen.getByRole("link", { name: "Go to ⁨Relay⁩" });
88-
expect(relayLink).toHaveAttribute(
89-
"href",
90-
process.env.FIREFOX_RELAY_LANDING_URL,
91-
);
100+
101+
const relayHref =
102+
process.env.FIREFOX_RELAY_LANDING_URL +
103+
"/accounts/fxa/login?process=login&" +
104+
bundleQueryParamsExternalProducts +
105+
"&auth_params=" +
106+
encodeURIComponent(promptNoneAuthParams);
107+
108+
expect(relayLink).toHaveAttribute("href", relayHref);
92109

93110
await user.click(relayLink);
94111

src/app/(bundle)/bundle/onboarding/BundleOnboardingView.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,35 @@ export type Props = {
1616
enabledFeatureFlags: FeatureFlagName[];
1717
};
1818

19+
export const bundleQueryParamsExternalProducts = new URLSearchParams({
20+
utm_medium: "referral",
21+
utm_source: "bundle-onboarding-page",
22+
utm_campaign: "evergreen",
23+
}).toString();
24+
25+
export const bundleQueryParamsMonitor = new URLSearchParams({
26+
utm_medium: "mozilla-websites",
27+
utm_source: "bundle",
28+
utm_campaign: "onboarding-page",
29+
utm_content: "launch-us",
30+
}).toString();
31+
32+
export const promptNoneAuthParams = new URLSearchParams({
33+
prompt: "none",
34+
}).toString();
35+
1936
export const BundleOnboardingView = (props: Props) => {
2037
const l10n = props.l10n;
38+
const relayLink =
39+
process.env.FIREFOX_RELAY_LANDING_URL +
40+
"/accounts/fxa/login?process=login&" +
41+
bundleQueryParamsExternalProducts +
42+
"&auth_params=" +
43+
encodeURIComponent(promptNoneAuthParams);
44+
const vpnLink =
45+
process.env.MOZILLA_VPN_LANDING_URL +
46+
"/download?" +
47+
bundleQueryParamsExternalProducts;
2148

2249
return (
2350
<main>
@@ -49,7 +76,7 @@ export const BundleOnboardingView = (props: Props) => {
4976
data: { button_id: "launch_vpn_download_page" },
5077
}}
5178
variant="primary"
52-
href={process.env.MOZILLA_VPN_LANDING_URL}
79+
href={vpnLink}
5380
>
5481
{l10n.getString("bundle-mozilla-vpn-cta")}
5582
</TelemetryButton>
@@ -70,7 +97,7 @@ export const BundleOnboardingView = (props: Props) => {
7097
data: { button_id: "launch_monitor" },
7198
}}
7299
variant="primary"
73-
href="/user/dashboard"
100+
href={`/user/dashboard?${bundleQueryParamsMonitor}`}
74101
>
75102
{l10n.getString("bundle-monitor-plus-cta")}
76103
</TelemetryButton>
@@ -91,7 +118,8 @@ export const BundleOnboardingView = (props: Props) => {
91118
data: { button_id: "launch_relay" },
92119
}}
93120
variant="primary"
94-
href={process.env.FIREFOX_RELAY_LANDING_URL}
121+
// Relay's OAuth library accepts the url params in auth_params and passes them through to the FxA OAuth url
122+
href={relayLink}
95123
>
96124
{l10n.getString("bundle-relay-premium-cta")}
97125
</TelemetryButton>

0 commit comments

Comments
 (0)