fix(metrics): force utm_source=email when signing in from CAD #6342
Conversation
Currently, the vast majority of our `fxa_reg - complete` events in Amplitude are incorrectly showing up with `utm_source` set to `email`. This is because the auth server forces it on all links in email addresses, so when the user clicks the verification link the original `utm_source` for that flow is overwritten. A separate PR for the auth server [1] has been opened to prevent this from happening. But in order for that PR not to break legitimate cases where we want `utm_source` set to `email`, we must first handle those legitimate cases elsewhere. Hence this PR. The connect-another-device view can only be reached from a verification email. When a user signs in from that view, we always want the new flow to have `utm_source` set to `email`. This change simply hard-codes the `utm_source` on signin links in that view. Related issues: * #6258 * mozilla/fxa-auth-server#2496 [1]: mozilla/fxa-auth-server#2505
@@ -231,7 +235,19 @@ define(function (require, exports, module) { | |||
* @private | |||
*/ | |||
_getEscapedSignInUrl (email) { | |||
return this.getEscapedSyncUrl('signin', ConnectAnotherDeviceView.ENTRYPOINT, { email: email }); | |||
return this.getEscapedSyncUrl('signin', ConnectAnotherDeviceView.ENTRYPOINT, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the exact approach I was thinking @philbooth!
I've tested this out in fxa-dev now, works well. These are the steps if anyone else wants to try it:
Moving to the review column, it would be good to get this on train 116 if nobody objects. @mozilla/fxa-devs r? |
Opening the email (edited to remove the resume token): Clicking "Sign in": Works perfectly, r+ Thanks @philbooth! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+
Related to: #6258, mozilla/fxa-auth-server#2496
Currently, the vast majority of our
fxa_reg - complete
events in Amplitude are incorrectly showing up withutm_source
set toemail
. This is because the auth server forces it on all links in email addresses, so when the user clicks the verification link the originalutm_source
for that flow is overwritten.A separate PR for the auth server has been opened to prevent this from happening. But in order for that PR not to break legitimate cases where we want
utm_source
set toemail
, we must first handle those legitimate cases elsewhere. Hence this PR.The connect-another-device view can only be reached from a verification email. When a user signs in from that view, we always want the new flow to have
utm_source
set toemail
. This change simply hard-codes theutm_source
on signin links in that view.@shane-tomlinson this is what I took out of our meeting with Alex and Leif just now, does it match up with what you're thinking?