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

experiment default metrics pixels #1107

Merged
merged 57 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
216a00e
implement experiment manager
SabrinaTardio Nov 8, 2024
d8b385c
Merge branch 'main' into sabrina/add-experiment-manager
SabrinaTardio Nov 8, 2024
914a5ed
fix lint issues
SabrinaTardio Nov 8, 2024
93247a3
fix linting issue
SabrinaTardio Nov 8, 2024
5d530f2
wrap UserDefaults
SabrinaTardio Nov 8, 2024
2dcef1e
fix linting
SabrinaTardio Nov 8, 2024
5aec88d
refactor
SabrinaTardio Nov 8, 2024
b188d67
fix linting
SabrinaTardio Nov 8, 2024
1054923
address some comments
SabrinaTardio Nov 8, 2024
c05aa96
minor refactor
SabrinaTardio Nov 8, 2024
8387472
use Constants enum
SabrinaTardio Nov 8, 2024
e862ad8
add Targets and configurations
SabrinaTardio Nov 11, 2024
6090a15
fix linting issues
SabrinaTardio Nov 11, 2024
14f92e9
initial implementation
SabrinaTardio Nov 12, 2024
8bda08c
add tests
SabrinaTardio Nov 14, 2024
9a19db2
Merge branch 'main' into sabrina/add-experiment-logic
SabrinaTardio Nov 14, 2024
56c54a7
refactor
SabrinaTardio Nov 15, 2024
86b7c97
getAllActiveExperiments tests
SabrinaTardio Nov 15, 2024
2595fcf
sort linting issues
SabrinaTardio Nov 15, 2024
86d6f7b
fix linting
SabrinaTardio Nov 15, 2024
95c4470
don't break the API
SabrinaTardio Nov 15, 2024
c30f0b4
Merge branch 'main' into sabrina/add-experiment-logic
SabrinaTardio Nov 15, 2024
727e813
implement PixelExperimentKit
SabrinaTardio Nov 21, 2024
69dc2fd
implement framework
SabrinaTardio Nov 27, 2024
cfe3b13
clean up
SabrinaTardio Nov 27, 2024
1e426e2
Merge branch 'main' into sabrina/experiment-framework
SabrinaTardio Nov 27, 2024
26fa2ed
fix linting
SabrinaTardio Nov 28, 2024
ee2f891
have only one interface method
SabrinaTardio Nov 28, 2024
b3224fe
fix lint
SabrinaTardio Nov 28, 2024
b057431
address comments
SabrinaTardio Nov 28, 2024
e92cbb5
Merge branch 'sabrina/experiment-framework' into sabrina/experiment-p…
SabrinaTardio Nov 28, 2024
4756b60
update after merge
SabrinaTardio Nov 29, 2024
4f2d28b
Merge branch 'main' into sabrina/experiment-pixels
SabrinaTardio Nov 29, 2024
d202980
cleanup
SabrinaTardio Nov 29, 2024
bfb7a5e
fix lint errors
SabrinaTardio Nov 29, 2024
a98e9c4
add pixel unique parameter test
SabrinaTardio Nov 29, 2024
7747bdc
remove unwanted code
SabrinaTardio Nov 29, 2024
92bb24f
refactor
SabrinaTardio Nov 29, 2024
e7801f9
refactor and add more tests
SabrinaTardio Dec 2, 2024
fc1c31e
add tests
SabrinaTardio Dec 2, 2024
f03d0e3
Merge branch 'main' into sabrina/experiment-pixels
SabrinaTardio Dec 2, 2024
f24740a
fix linting
SabrinaTardio Dec 2, 2024
aef82dd
linting
SabrinaTardio Dec 2, 2024
9b65cc7
linting
SabrinaTardio Dec 2, 2024
4992efe
implement firing enrolment pixel
SabrinaTardio Dec 3, 2024
4412bd4
Merge branch 'main' into sabrina/experiment-pixels
SabrinaTardio Dec 3, 2024
b202b44
fix tests
SabrinaTardio Dec 3, 2024
c62fac4
generalise headers and prefix name
SabrinaTardio Dec 3, 2024
cc6c1b6
address comments
SabrinaTardio Dec 4, 2024
b567a22
add isDry for new unique params
SabrinaTardio Dec 4, 2024
2b0f434
fix linting
SabrinaTardio Dec 4, 2024
15eed7b
fix tests
SabrinaTardio Dec 4, 2024
e0e45ca
fix iOS pixel naming
SabrinaTardio Dec 4, 2024
cd6d89a
address comments and remove m_ from experiments
SabrinaTardio Dec 5, 2024
9568123
remove unwanted change
SabrinaTardio Dec 5, 2024
8db91da
fix mac pixel names
SabrinaTardio Dec 9, 2024
8c2a9c6
fix test
SabrinaTardio Dec 4, 2024
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
8 changes: 5 additions & 3 deletions Sources/PixelKit/PixelKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public final class PixelKit {

var headers = headers ?? defaultHeaders
headers[Header.moreInfo] = "See " + Self.duckDuckGoMorePrivacyInfo.absoluteString
// Needs to be updated/generalised when fully adopted by iOS
if let source {
switch source {
case Source.iOS.rawValue:
Expand All @@ -204,7 +205,7 @@ public final class PixelKit {
case Source.macDMG.rawValue, Source.macStore.rawValue:
headers[Header.client] = "macOS"
default:
break
headers[Header.client] = "macOS"
Copy link
Contributor

Choose a reason for hiding this comment

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

won't it have some side effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically so far is always macOS and we have some NetP etc sources that still want macOS header, so basically all I am doing here is making sure that is it comes from iOS (that for now it is only used for the experiment) it has the iOS/ipadOS header… avoiding changes for anything else that is using it currently.
When we do the full migration we will need to adjust it but we need to consider other Sources as well

}
}

Expand Down Expand Up @@ -395,6 +396,7 @@ public final class PixelKit {
fireRequest(pixelName, headers, parameters, allowedQueryReservedCharacters, callBackOnMainThread, onComplete)
}

// Needs to be updated when fully adopted by iOS
private func prefixedName(for event: Event) -> String {
if event.name.hasPrefix("m_mac_") {
// Can be a debug event or not, if already prefixed the name remains unchanged
Expand All @@ -415,10 +417,10 @@ public final class PixelKit {
case Source.macDMG.rawValue, Source.macStore.rawValue:
return "m_mac_\(event.name)"
default:
break
return "m_mac_\(event.name)"
}
}
return event.name
return "m_mac_\(event.name)"
}
}

Expand Down
Loading