Skip to content

[MOB-4146] Update Snowplow Mini Staging URL#1065

Merged
lucaschifino merged 4 commits intomainfrom
ls-mob-4146-update-snowplow-mini-staging-url
Mar 3, 2026
Merged

[MOB-4146] Update Snowplow Mini Staging URL#1065
lucaschifino merged 4 commits intomainfrom
ls-mob-4146-update-snowplow-mini-staging-url

Conversation

@lucaschifino
Copy link
Copy Markdown
Collaborator

@lucaschifino lucaschifino commented Feb 25, 2026

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 🎉
Screenshot 2026-03-02 at 16 53 10

Before merging

Checklist

  • I performed some relevant testing on a real device and/or simulator for both iPhone and iPad
  • I made sure that any change to the Analytics events included in PR won't alter current analytics (e.g. new users, upgrading users)

@lucaschifino lucaschifino marked this pull request as ready for review March 2, 2026 15:57
Copilot AI review requested due to automatic review settings March 2, 2026 15:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.snowplow staging endpoint (and regrouped environment cases).
  • Updated Snowplow NetworkConfiguration to 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 a urlProvider parameter (primarily for testing), but the new header behavior is driven by EcosiaEnvironment.current.cloudFlareAuth instead of something derived from the passed urlProvider. With the micro-condition removed, this makes the output dependent on the app bundle ID (and environment variables) even when a test injects a urlProvider, which is hard to control in unit tests and can lead to mismatched configs when urlProvider is not the current environment. Consider threading an environment (or cloudFlareAuth) parameter into makeNetworkConfig with 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
                ])

Comment thread firefox-ios/Ecosia/Core/Environment/URLProvider.swift
public var snowplow: String {
switch self {
case .production:
case .production, .debug:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Moved debug together with production since both use "ecosia.org" as root domain, so analytics should stay aligned.

@lucaschifino lucaschifino requested a review from a team March 2, 2026 16:15
@lucaschifino
Copy link
Copy Markdown
Collaborator Author

Unrelated EcosiaHomeViewModelTests.testNumberOfSections tests have been failing since yesterday here, as well as in other PRs.

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.

Copy link
Copy Markdown
Member

@d4r1091 d4r1091 left a comment

Choose a reason for hiding this comment

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

Thanks for passing the environment as part of the NetworkConfiguration factory 🙏

@lucaschifino lucaschifino merged commit b3d45f8 into main Mar 3, 2026
2 of 4 checks passed
@lucaschifino lucaschifino deleted the ls-mob-4146-update-snowplow-mini-staging-url branch March 3, 2026 10:30
d4r1091 pushed a commit that referenced this pull request Mar 7, 2026
* [MOB-4146] Update Snowplow Mini Staging URL

* [MOB-4146] Use staging endpoint instead

* [MOB-4146] Fix and improve tests

* [MOB-4146] Fix URLProviderTests
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.

3 participants