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

Add PixelKit source parameter #1989

Merged
merged 1 commit into from
Dec 21, 2023
Merged

Conversation

samsymons
Copy link
Collaborator

Task/Issue URL: https://app.asana.com/0/0/1206203334750907/f
Tech Design URL:
CC:

Description:

This PR adds a source parameter to the PixelKit setUp function, to allow us to include which target is sending the pixel.

Steps to test this PR:

  1. Run the app and check that pixels are sending with the correct parameters - Console.app can be used for this, or for the VPN agent you can attach the debugger directly. Alternatively, make a release build and check the real pixel calls in Kibana.

Internal references:

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

@@ -41,6 +41,7 @@ final class DuckDuckGoDBPBackgroundAgentApplication: NSApplication {

PixelKit.setUp(dryRun: dryRun,
appVersion: AppVersion.shared.versionNumber,
source: nil,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not adding this to DBP since I don't want to modify their pixels unannounced. I'll let them know about this change and they can choose to set this if they wish.

Copy link
Contributor

Choose a reason for hiding this comment

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

Once they accept it we should consider making the source param non-optional, IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed 👍

Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

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

Nice work!

Comment on lines +90 to +109
/// Sets up PixelKit for the entire app.
///
/// - Parameters:
/// - `dryRun`: if `true`, simulate requests and "send" them at an accelerated rate (once every 2 minutes instead of once a day)
/// - `source`: if set, adds a `pixelSource` parameter to the pixel call; this can be used to specify which target is sending the pixel
/// - `fireRequest`: this is not triggered when `dryRun` is `true`
public static func setUp(dryRun: Bool = false,
appVersion: String,
source: String? = nil,
defaultHeaders: [String: String],
log: OSLog,
defaults: UserDefaults,
fireRequest: @escaping FireRequest) {
shared = PixelKit(dryRun: dryRun,
appVersion: appVersion,
source: source,
defaultHeaders: defaultHeaders,
log: log,
defaults: defaults,
fireRequest: fireRequest)
Copy link
Contributor

Choose a reason for hiding this comment

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

🤩

@@ -41,6 +41,7 @@ final class DuckDuckGoDBPBackgroundAgentApplication: NSApplication {

PixelKit.setUp(dryRun: dryRun,
appVersion: AppVersion.shared.versionNumber,
source: nil,
Copy link
Contributor

Choose a reason for hiding this comment

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

Once they accept it we should consider making the source param non-optional, IMO.

@samsymons samsymons merged commit 9823186 into main Dec 21, 2023
14 checks passed
@samsymons samsymons deleted the sam/add-pixel-source-parameter branch December 21, 2023 17:47
samsymons added a commit that referenced this pull request Dec 21, 2023
# By Dominik Kapusta (41) and others
# Via Dominik Kapusta (9) and others
* main: (138 commits)
  Make sure when we set custom config url, we don't expect etag in return (#1994)
  Add PixelKit source parameter (#1989)
  Fix internal user toggling (#2000)
  Show alert and display warning icon in Sync Settings when data syncing is disabled (#1996)
  DBP: Integrate subscription account authentication to DBP (#1995)
  Improve bookmarks html reader (#1986)
  Add Sync feature flags (#1992)
  Add daily stats pixel (#1993)
  Do not reload DBP tab when switching to it (#1942)
  Fix: external application requests via redirect URLs shows wrong origin. (#1900)
  Update clean-app.sh to work on macOS Sonoma and include NetP containers (#1988)
  Fix: "SwiftLintPlugin" must be enabled before it can be used (#1987)
  Prevent VPN server list persistence failures (#1985)
  add test can remove data (#1980)
  Remove VPN upgrade card (#1983)
  Fix low-res VPN warning asset (#1984)
  DBP: Fix unreliable date tests (#1981)
  Add search retention pixel for NetP (#1964)
  Sabrina/sync e2e tests (#1959)
  swiftlint build plugin (#1318)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Application/AppDelegate.swift
samsymons added a commit that referenced this pull request Dec 22, 2023
# By Dominik Kapusta (2) and others
# Via GitHub
* main:
  Make sure when we set custom config url, we don't expect etag in return (#1994)
  Add PixelKit source parameter (#1989)
  Fix internal user toggling (#2000)
  Show alert and display warning icon in Sync Settings when data syncing is disabled (#1996)
  DBP: Integrate subscription account authentication to DBP (#1995)
  Improve bookmarks html reader (#1986)
  Add Sync feature flags (#1992)
  Add daily stats pixel (#1993)
  Do not reload DBP tab when switching to it (#1942)
  Fix: external application requests via redirect URLs shows wrong origin. (#1900)

# Conflicts:
#	DuckDuckGo/Statistics/PixelEvent.swift
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