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

Subscription pro pixels #2531

Merged
merged 21 commits into from
Mar 11, 2024
Merged

Conversation

federicocappelli
Copy link
Member

@federicocappelli federicocappelli commented Mar 4, 2024

Task/Issue URL: https://app.asana.com/0/1200019156869587/1205469290776415/f

Description:
Please hide whitespace changes when reviewing, this PR includes many swiftlint fixes to old code
Pixels added to all privacy pro subscription flows.

Steps to test this PR:
Please refer to https://app.asana.com/0/1205842942115003/1205469314884687/f for how to trigger the pixels
I re-run every scenario in the list above except the backend and Apple Store errors that I have no way to trigger.

--

New Pixels

Trigger Type Enum Value
Fires every 24 hours when subscription is active in the app Daily pixel privacyProSubscriptionActive
When a user navigates to the subscription offer page Count pixel privacyProOfferScreenImpression
When a user clicks "subscribe" in the purchase bottom sheet in the Terms & Conditions Count Pixel + Daily Pixel privacyProPurchaseAttempt
When the "Something Went Wrong" alert appears during purchase Count Pixel + Daily Pixel privacyProPurchaseFailure
When a subscription purchase fails because of a store error Count Pixel + Daily Pixel privacyProPurchaseFailureStoreError
When a subscription purchase fails because our BE failed Count Pixel + Daily Pixel privacyProPurchaseFailureBackendError
When a subscription purchase fails because our BE failed Count Pixel + Daily Pixel privacyProPurchaseFailureBackendError
When a subscription purchase fails because we could not create an account Count Pixel + Daily Pixel privacyProPurchaseFailureAccountNotCreated
When the "Your purchase was successful" alert appears Count Pixel + Daily Pixel privacyProPurchaseSuccess
When a user clicks "I have a subscription" ("Restore Purchase " in iOS) on the subscription offer page Count pixel privacyProRestorePurchaseOfferPageEntry
When a user clicks the "Enter Email" button in the Email cell in the "Activate Subscription" submenu Count pixel + Daily Pixel privacyProRestorePurchaseEmailStart
When a user clicks the "Restore Purchase" button in the Google Play / Apple ID cell in the "Activate Subscription" submenu Count pixel + Daily Pixel privacyProRestorePurchaseStoreStart
When a user successfully restores subscription using email address Count pixel + Daily Pixel privacyProRestorePurchaseEmailSuccess
When a user successfully restores subscription using apple store Count pixel + Daily Pixel privacyProRestorePurchaseStoreSuccess
When restoring subscription using Apple ID / Google Play fails because no active subscription is found in the Store Count pixel + Daily Pixel privacyProRestorePurchaseStoreFailureNotFound
When restoring subscription using Apple ID / Google Play fails for any reason other than no active subscription is found in the Store. Count pixel + Daily Pixel privacyProRestorePurchaseStoreFailureOther
When a user clicks "subscribe" in the purchase bottom sheet in the Terms & Conditions and has their subscription restored because one already exists. Count Pixel privacyProRestoreAfterPurchaseAttempt
When a subscription is activated for the first time in the app Unique pixel privacyProSubscriptionActivated
when a user clicks "Add to Another Device" in the subscriptions settings page Count Pixel privacyProSettingsAddDevice
when a user clicks "Add Email" in the Add Device submenu in subscription settings Count pixel privacyProAddDeviceEnterEmail
when a user clicks "View" for the VPN in the post-subscription onboarding flow Unique pixel privacyProWelcomeVPN
when a user clicks "View" for PIR in the post-subscription onboarding flow Unique pixel privacyProWelcomePersonalInformationRemoval
when a user clicks "View" for IDTR in the post-subscription onboarding flow Unique pixel privacyProWelcomeIdentityRestoration
when a user clicks the button to access Subscription Settings on the settings page, after their subscription is active Count pixel privacyProSubscriptionSettings
when a user clicks the button to access the VPN on the settings page, after their subscription is active Count pixel privacyProVPNSettings
when a user clicks the button to access PIR on the settings page, after their subscription is active Count pixel privacyProPersonalInformationRemovalSettings
when a user clicks the button to access IDTR on the settings page, after their subscription is active Count pixel privacyProIdentityRestorationSettings
User clicks the edit button on the "manage email" submenu Count pixel privacyProSubscriptionManagementEmail
User clicks "change plan or billing" on the subscription settings menu Count pixel privacyProSubscriptionManagementPlanBilling
User clicks "remove subscription" button in alert count pixel privacyProSubscriptionManagementRemoval

# Conflicts:
#	DuckDuckGo/Subscription/Views/SubscriptionFlowView.swift
#	DuckDuckGo/Subscription/Views/SubscriptionRestoreView.swift
# Conflicts:
#	DuckDuckGo/Subscription/UserScripts/SubscriptionPagesUseSubscriptionFeature.swift
#	DuckDuckGo/Subscription/ViewModel/SubscriptionRestoreViewModel.swift
# Conflicts:
#	Core/PixelEvent.swift
#	DuckDuckGo.xcodeproj/project.pbxproj
@github-actions github-actions bot added the bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project label Mar 4, 2024
Copy link

github-actions bot commented Mar 4, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against c607de4

@federicocappelli federicocappelli changed the title Fcappelli/subscriptionpro pixels Subscription pro pixels Mar 4, 2024
@federicocappelli federicocappelli removed Do Not Merge bot: not in app board Added by automation for pull requests with tasks not added to iOS App Board Asana project labels Mar 4, 2024
@federicocappelli federicocappelli marked this pull request as ready for review March 4, 2024 16:36
@afterxleep
Copy link
Collaborator

@federicocappelli

Code looks fine, but I left a few questions about Daily pixels and some recommendations on moving some of the calls to the ViewModel.

While I can run every feature scenario, I don't have enough context to understand which pixels should fire in every case and when.- While the code looks mostly fine to me, If you want me to test this in detail, I'll need detailed instructions on where in the process each pixel should be fired. (I don't necessarily have enough context on the project and discussions to infer this)

DuckDuckGo/AppDelegate.swift Outdated Show resolved Hide resolved
DuckDuckGo/SettingsSubscriptionView.swift Outdated Show resolved Hide resolved
DuckDuckGo/SettingsSubscriptionView.swift Outdated Show resolved Hide resolved
DuckDuckGo/SettingsSubscriptionView.swift Outdated Show resolved Hide resolved
@afterxleep
Copy link
Collaborator

@federicocappelli I updated the description to add the pixel list as a quick table so it's quick to review/validate. This may also be useful for the macOS part.

@afterxleep
Copy link
Collaborator

@federicocappelli It seems some pixels are not correct when restoring a subscription.

I did this:

  1. Open the app
  2. Go to settings
  3. Tap I have A subscription
  4. Tap Restore (With no subscription)
  5. Get error "Subscription Not found"

I'm seeing duplicate pixels fired, as well as several failures that shouldn't be fired here.

These pixels were fired.
✅ - Pixel fired m_privacy-pro_offer_screen_impression [:]
⚠️ - Pixel fired m_privacy-pro_settings_add-device_click [:]
⚠️ - Pixel fired m_privacy-pro_settings_add-device_click [:]
✅ - Pixel fired m_privacy-pro_activate-subscription_restore-purchase_click_c [:]
⚠️ - Pixel fired m_privacy-pro_activate-subscription_restore-purchase_click_d [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-purchase_failure_other_c [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-purchase_failure_other_d [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-purchase_failure_store_c [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-purchase_failure_store_d [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-restore-using-store_failure_other_c [:]
⚠️ - Pixel fired m_privacy-pro_app_subscription-restore-using-store_failure_other_d [:]

@afterxleep
Copy link
Collaborator

afterxleep commented Mar 6, 2024

Cancelling the purchase, fires this twice.

  • Select a subcription
  • Tap purchase
  • Cancel the apple dialog.
- Pixel fired m_privacy-pro_app_subscription-purchase_failure_store_c [:]
- Pixel fired m_privacy-pro_app_subscription-purchase_failure_other_c [:]

# Conflicts:
#	Core/PixelEvent.swift
#	Core/UserAgentManager.swift
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo/SettingsSubscriptionView.swift
# Conflicts:
#	Core/PixelEvent.swift
#	submodules/privacy-reference-tests
Copy link
Collaborator

@afterxleep afterxleep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks ok, but I still see some duplicate pixels and misfires. Let's get this merged to prevent more conflicts and iterate on that later

@federicocappelli federicocappelli merged commit 3e69aa5 into main Mar 11, 2024
13 checks passed
@federicocappelli federicocappelli deleted the fcappelli/subscriptionpro_pixels branch March 11, 2024 10:49
samsymons added a commit that referenced this pull request Mar 13, 2024
* main:
  Subscriptions: 20 - Subscription Caching (#2569)
  Subscriptions: 19. Error handling and minor updates (#2567)
  Use History on iOS (#2539)
  Release 7.112.0-1 (#2573)
  Report on toggle protections off (#2536)
  Release 7.112.0-0 (#2572)
  Update autoconsent to v10.2.0 (#2554)
  update metadata (#2571)
  Subscription pro pixels (#2531)
  Update SwiftSoup and Kingfisher versions (#2566)
  Move vpnFirstEnabled and networkPathChange out of VPNSettings (#2560)
  Fix VPN view model memory leak (#2570)
  Bump submodules/privacy-reference-tests from `40ce868` to `a603ff9` (#2500)
  18. Subscription Entitlements caching (#2556)
  Release 7.111.0-2 (#2563)
  Revert "Report Apple Ad attribution using pixel (#2510)" (#2562)
  Vanilla browser integration (#2550)
  Fix blank space after URL bar hides (#2549)
  Release 7.111.0-1 (#2561)
samsymons added a commit that referenced this pull request Mar 13, 2024
…-lottie-animation

* sam/vpn-ui-improvements:
  Subscriptions: 20 - Subscription Caching (#2569)
  Subscriptions: 19. Error handling and minor updates (#2567)
  Use History on iOS (#2539)
  Release 7.112.0-1 (#2573)
  Report on toggle protections off (#2536)
  Release 7.112.0-0 (#2572)
  Update autoconsent to v10.2.0 (#2554)
  update metadata (#2571)
  Subscription pro pixels (#2531)
  Update SwiftSoup and Kingfisher versions (#2566)
  Move vpnFirstEnabled and networkPathChange out of VPNSettings (#2560)
  Fix VPN view model memory leak (#2570)
  Bump submodules/privacy-reference-tests from `40ce868` to `a603ff9` (#2500)
  18. Subscription Entitlements caching (#2556)
  Release 7.111.0-2 (#2563)
  Revert "Report Apple Ad attribution using pixel (#2510)" (#2562)
  Vanilla browser integration (#2550)
  Fix blank space after URL bar hides (#2549)
  Release 7.111.0-1 (#2561)
samsymons added a commit that referenced this pull request Mar 13, 2024
…n-ui-improvements-3-combine-notification-settings

* sam/vpn-ui-improvements-2-lottie-animation:
  Subscriptions: 20 - Subscription Caching (#2569)
  Subscriptions: 19. Error handling and minor updates (#2567)
  Use History on iOS (#2539)
  Release 7.112.0-1 (#2573)
  Report on toggle protections off (#2536)
  Release 7.112.0-0 (#2572)
  Update autoconsent to v10.2.0 (#2554)
  update metadata (#2571)
  Subscription pro pixels (#2531)
  Update SwiftSoup and Kingfisher versions (#2566)
  Move vpnFirstEnabled and networkPathChange out of VPNSettings (#2560)
  Fix VPN view model memory leak (#2570)
  Bump submodules/privacy-reference-tests from `40ce868` to `a603ff9` (#2500)
  18. Subscription Entitlements caching (#2556)
  Release 7.111.0-2 (#2563)
  Revert "Report Apple Ad attribution using pixel (#2510)" (#2562)
  Vanilla browser integration (#2550)
  Fix blank space after URL bar hides (#2549)
  Release 7.111.0-1 (#2561)
samsymons added a commit that referenced this pull request Mar 13, 2024
…' into sam/vpn-ui-improvements-4-location-setting-change

# By Mariusz Śpiewak (3) and others
# Via Sam Symons (4) and others
* sam/vpn-ui-improvements-3-combine-notification-settings:
  Subscriptions: 20 - Subscription Caching (#2569)
  Subscriptions: 19. Error handling and minor updates (#2567)
  Use History on iOS (#2539)
  Release 7.112.0-1 (#2573)
  Report on toggle protections off (#2536)
  Release 7.112.0-0 (#2572)
  Update autoconsent to v10.2.0 (#2554)
  update metadata (#2571)
  Subscription pro pixels (#2531)
  Update SwiftSoup and Kingfisher versions (#2566)
  Move vpnFirstEnabled and networkPathChange out of VPNSettings (#2560)
  Fix VPN view model memory leak (#2570)
  Bump submodules/privacy-reference-tests from `40ce868` to `a603ff9` (#2500)
  18. Subscription Entitlements caching (#2556)
  Release 7.111.0-2 (#2563)
  Revert "Report Apple Ad attribution using pixel (#2510)" (#2562)
  Vanilla browser integration (#2550)
  Fix blank space after URL bar hides (#2549)
  Release 7.111.0-1 (#2561)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants