fix(metrics): don't force utm_source=email on links in emails #2505
Conversation
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.
@philbooth I wonder if we can use a semi-blunt instrument. Possible updating _generateUTMLink
to take an optional param forceEmailUtm
(something along those lines). It seems like the only link that needs to keep the original utm_source is the primary link of the email.
test/local/senders/email.js
Outdated
@@ -376,6 +389,7 @@ describe( | |||
|
|||
mailer.mailer.sendMail = function (emailConfig) { | |||
assert.ok(includes(emailConfig.html, androidStoreLink)) | |||
assert.ok(! includes(emailConfig.html, 'utm_source=email')) |
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.
I think this was one of the scenarios we mentioned that the utm_source
was actually an email. Would we lose any downstream events in amplitude or adjust that track app installs from our email?
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.
Does it make sense to enable "utm_source=email" for the app store links only so we don't lose these metrics?
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.
Genuinely I have no idea. That wasn't what I took from the meeting on Friday though. Let's check with @davismtl.
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.
Fwiw, I've reinstated utm_source=email
on the app store links directly in config.
utm_source=email is used in when the user verifies a signin/signup on a second device. If the user verifies on a 2nd device, the connect another device logic determines whether the user can sign in, and if so, we consider this a new flow. This situation is a bit strange, because there are two potential flows involved. We have the flow being completed, and the potential new flow. The new flow should have a utm_source=email and we propagate that field here. What if all the utm_ fields sent by the email were the same as the utm_ params at the beginning of the flow, but we added an additional field that indicates the user is coming from an email, perhaps |
I feel a bit out of my depth discussing the possibilities here, because there's so much of the surrounding framework that I'm not familiar with. @davismtl or @irrationalagent have you got some time today or tomorrow to chat with us about the correct solution to this issue / mozilla/fxa-content-server#6258? |
I'm happy to be part of this chat too. @davismtl and I are already meeting at 16.00 BST, want to join us to discuss? |
👍 |
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
Tested on Instructions for testing in mozilla/fxa-content-server#6342 (comment). @mozilla/fxa-devs r? |
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.
Looks great, only question is how to handle app store links. If we decide we don't care about those, r+. Maybe we can add utm_source=email for just the app store links?
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. [1]: mozilla/fxa-auth-server#2505 Related issues: * #6258 * mozilla/fxa-auth-server#2496 #6342 r=shane-tomlinson
I'm a bit confused by this. Which app store links are you referring to? The ones in the emails? |
I'm putting this forward as a blunt-instrument proposal to fix mozilla/fxa-content-server#6258. It completely removes
utm_source=email
from the links we send out, which has the obvious knock-on effect of not overwritingutm_source
in Amplitude:Compare those events, generated with this change, to the ones logged in #2496 (comment).
Is this too blunt an instrument to fix the problem with? Are we relying on
utm_source=email
for some other reason? Forgive me if that got discussed in the meeting on Tuesday, I wasn't paying attention properly at the time.If we need something more fine-grained, I can make some kind of change in the content server that specifically disables
utm_source
just for those events, but that approach feels more hackish to me.@mozilla/fxa-devs r?