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

fire experiment pixels #3622

Merged
merged 8 commits into from
Dec 5, 2024
Merged

fire experiment pixels #3622

merged 8 commits into from
Dec 5, 2024

Conversation

SabrinaTardio
Copy link
Collaborator

@SabrinaTardio SabrinaTardio commented Dec 3, 2024

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

Optional E2E tests:

  • Run PIR E2E tests
    Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this.

Steps to test this PR:

  1. Somewhere in the code base (maybe in FeatureFlag) 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
    }
}
  1. Assign the cohort somewhere (for example in HomePageContinueSetUpModel initialiser)
    let cohort = Application.appDelegate.featureFlagger.getCohortIfEnabled(for: CredentialsSavingFlag())

  2. In AppConfigurationURLProvider on line 57 change the url with https://www.jsonblob.com/api/jsonBlob/1313198249494110208

  3. Run the app and check that the following pixel is sent: m_mac_experiment_enroll_credentialsSaving_blue (or control) with the expected parameters

  4. Perform 4 searches and check that only one experiment pixel is fired: m_mac_experiment_metrics_credentialsSaving_blue ["pixelSource": "browser-dmg", "metric": "search", "enrollmentDate": "2024-12-04", "value": "1", "conversionWindowDays": "0”]

  5. Move the system date to the following day and perform 4 searches and 4 site visits, only 2 pixels should be fired:
    m_mac_experiment_metrics_credentialsSaving_blue ["pixelSource": "browser-dmg", "metric": "search", "enrollmentDate": "2024-12-05", "value": "1", "conversionWindowDays": “1”]
    m_mac_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

<!—
Tagging instructions
If this PR isn't ready to be merged for whatever reason it should be marked with the DO NOT MERGE label (particularly if it's a draft)
If it's pending Product Review/PFR, please add the Pending Product Review label.

If at any point it isn't actively being worked on/ready for review/otherwise moving forward (besides the above PR/PFR exception) strongly consider closing it (or not opening it in the first place). If you decide not to close it, make sure it's labelled to make it clear the PRs state and comment with more information.
—>

Definition of Done:

Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@SabrinaTardio SabrinaTardio marked this pull request as ready for review December 4, 2024 10:36
Copy link
Contributor

@jaceklyp jaceklyp left a comment

Choose a reason for hiding this comment

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

LGTM :)

SabrinaTardio added a commit to duckduckgo/BrowserServicesKit that referenced this pull request Dec 5, 2024
Task/Issue URL:
https://app.asana.com/0/1204186595873227/1208775176602791/f
iOS PR:  in prep
macOS PR:  duckduckgo/macos-browser#3622
What kind of version bump will this require?: N/A

Tech Design URL:
https://app.asana.com/0/1204186595873227/1208682592686299


**Description**: Implements PixelExperimentKit to provide Experiment
metrics API to clients
@SabrinaTardio SabrinaTardio merged commit 7b2a893 into main Dec 5, 2024
20 checks passed
@SabrinaTardio SabrinaTardio deleted the sabrina/experiment-pixels branch December 5, 2024 13:38
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