Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofill shown should not update lastUsed #1891

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Autofill shown should not update lastUsed
Signed-off-by: Emanuele Feliziani <feliziani.emanuele@gmail.com>
  • Loading branch information
GioSensation committed Apr 12, 2023
commit 8bc4cb7c3023ad37290d63364f75a052e2146400
12 changes: 7 additions & 5 deletions shared/js/background/email-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const getFullPixelName = (name, browserName) => {
return `${name}_${browserName.toLowerCase()}`
}

const fireAddressUsedPixel = (pixel) => {
const fireAutofillPixel = (pixel, shouldUpdateLastUsed = true) => {
GioSensation marked this conversation as resolved.
Show resolved Hide resolved
const browserName = utils.getBrowserName() ?? 'unknown'
if (!pixelsEnabled) return

Expand All @@ -119,7 +119,9 @@ const fireAddressUsedPixel = (pixel) => {
const lastAddressUsedAt = getSetting('lastAddressUsedAt') ?? ''

sendPixelRequest(getFullPixelName(pixel, browserName), { duck_address_last_used: lastAddressUsedAt, cohort: userData.cohort })
updateSetting('lastAddressUsedAt', currentDate())
if (shouldUpdateLastUsed) {
updateSetting('lastAddressUsedAt', currentDate())
}
}

const fireIncontextSignupPixel = (pixel) => {
Expand All @@ -143,13 +145,13 @@ export const sendJSPixel = (options) => {
const { pixelName } = options
switch (pixelName) {
case 'autofill_show':
fireAddressUsedPixel('email_tooltip_show_extension')
fireAutofillPixel('email_tooltip_show_extension', false)
break
case 'autofill_private_address':
fireAddressUsedPixel('email_filled_random_extension')
fireAutofillPixel('email_filled_random_extension')
break
case 'autofill_personal_address':
fireAddressUsedPixel('email_filled_main_extension')
fireAutofillPixel('email_filled_main_extension')
break
case 'incontext_show':
fireIncontextSignupPixel('incontext_show_extension')
Expand Down