Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Task/Issue URL: https://app.asana.com/0/1204186595873227/1208775176602791/f
Tech Design URL: https://app.asana.com/0/1204186595873227/1208682592686299
CC:
Description: Implements PixelExperimentKit to provide Experiment metrics API to clients and fires pixel for preset experiment metrics
Steps to test this PR:
Somewhere in the code base (maybe in NewTabPageViewModel) add this Experiment Feature Flag:
public struct CredentialsSavingFlag: FeatureFlagExperimentDescribing {
public init() {}
public typealias CohortType = Cohort
public var rawValue = "credentialSaving"
public var source: FeatureFlagSource = .remoteReleasable(.subfeature(AutofillSubfeature.credentialsSaving))
public enum Cohort: String, FlagCohort {
case control
case blue
}
}
Assign the cohort somewhere (for example in NewTabPageViewModel initialiser)
let cohort = Application.appDelegate.featureFlagger.getCohortIfEnabled(for: CredentialsSavingFlag())
In AppURLs.swift change the PrivacyConfig URL to https://www.jsonblob.com/api/jsonBlob/1313198249494110208
Run the app and check that the following pixel is sent: m_mac_experiment_enroll_credentialsSaving_blue (or control) with the expected parameters
Perform 4 searches and and foreground the app 4 times check that only one experiment pixel is fired: m_ios_experiment_metrics_credentialsSaving_blue ["pixelSource": "browser-dmg", "metric": "search", "enrollmentDate": "2024-12-04", "value": "1", "conversionWindowDays": "0”]
Move the system date to the following day and perform 4 searches and 4 foregorunding, only 2 pixels should be fired:
m_ios_experiment_metrics_credentialsSaving_blue ["pixelSource": "browser-dmg", "metric": "search", "enrollmentDate": "2024-12-05", "value": "1", "conversionWindowDays": “1”]
m_ios_experiment_metrics_credentialsSaving_blue ["pixelSource": "browser-dmg", "metric": “ app_use", "enrollmentDate": "2024-12-05", "value": "1", "conversionWindowDays": “1”]
7 Try the same up to day 4
8 On day 5 do the same and in this case you should see multiple pixels:
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["conversionWindowDays": "5", "value": "1", "enrollmentDate": "2024-12-04", "metric": "search", "pixelSource": "browser-dmg"]
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["pixelSource": "browser-dmg", "conversionWindowDays": "5-7", "enrollmentDate": "2024-12-04", "value": "1", "metric": "search"]
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["pixelSource": "browser-dmg", "value": "1", "conversionWindowDays": "5", "metric": "app_use", "enrollmentDate": "2024-12-04"]
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["metric": "app_use", "conversionWindowDays": "5-7", "pixelSource": "browser-dmg", "enrollmentDate": "2024-12-04", "value": "1"]
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["value": "4", "pixelSource": "browser-dmg", "conversionWindowDays": "5-7", "metric": "search", "enrollmentDate": "2024-12-04"]
👾[Unique By Name And Parameters-Fired] m_mac_experiment_metrics_credentialsSaving_control ["value": "4", "enrollmentDate": "2024-12-04", "metric": "app_use", "pixelSource": "browser-dmg", "conversionWindowDays": "5-7”]
Note: I recommend Filter by Unique By Name And Parameters-Fired
Definition of Done (Internal Only):
Copy Testing:
’
rather than'
Orientation Testing:
Device Testing:
OS Testing:
Theme Testing:
Internal references:
Software Engineering Expectations
Technical Design Template