[MOB-4146] Update Snowplow Mini Staging URL#1065
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Ecosia’s Snowplow collector configuration to support the BI migration, primarily by changing the staging “mini” collector URL and adjusting when Cloudflare authentication headers are applied.
Changes:
- Updated
URLProvider.snowplowstaging endpoint (and regrouped environment cases). - Updated Snowplow
NetworkConfigurationto attach Cloudflare headers whenever available (not only for micro).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
firefox-ios/Ecosia/Core/Environment/URLProvider.swift |
Changes how the Snowplow endpoint is selected for staging/debug/production. |
firefox-ios/Ecosia/Analytics/Analytics.swift |
Adjusts when Cloudflare auth headers are added to the Snowplow network config. |
Comments suppressed due to low confidence (1)
firefox-ios/Ecosia/Analytics/Analytics.swift:536
makeNetworkConfig(urlProvider:)accepts aurlProviderparameter (primarily for testing), but the new header behavior is driven byEcosiaEnvironment.current.cloudFlareAuthinstead of something derived from the passedurlProvider. With the micro-condition removed, this makes the output dependent on the app bundle ID (and environment variables) even when a test injects aurlProvider, which is hard to control in unit tests and can lead to mismatched configs whenurlProvideris not the current environment. Consider threading anenvironment(orcloudFlareAuth) parameter intomakeNetworkConfigwith a default of.current, and add/update a unit test asserting that the mini (non-micro) staging configuration includes the Cloudflare headers.
let endpoint = shouldUseMicroInstance ? urlProvider.snowplowMicro : urlProvider.snowplow
var networkConfig = NetworkConfiguration(endpoint: endpoint!)
if let auth = EcosiaEnvironment.current.cloudFlareAuth {
networkConfig = networkConfig
.requestHeaders([
CloudflareKeyProvider.clientId: auth.id,
CloudflareKeyProvider.clientSecret: auth.secret
])
| public var snowplow: String { | ||
| switch self { | ||
| case .production: | ||
| case .production, .debug: |
There was a problem hiding this comment.
Moved debug together with production since both use "ecosia.org" as root domain, so analytics should stay aligned.
|
Unrelated Can't find a relation though, not sure if something else on main broke it 🤔 Would not put it as a blocker of this PR as it might be flakiness and changes are definitely unrelated. |
d4r1091
left a comment
There was a problem hiding this comment.
Thanks for passing the environment as part of the NetworkConfiguration factory 🙏
* [MOB-4146] Update Snowplow Mini Staging URL * [MOB-4146] Use staging endpoint instead * [MOB-4146] Fix and improve tests * [MOB-4146] Fix URLProviderTests
MOB-4146
Context
Using new URL from BI migration.
Approach
Updating URLProvider and removing micro condition from existing Cloudflare header Snowplow configuration.
Checked events are coming to the dashboard 🎉

Before merging
Checklist