Research: design the "Disable tracking" patches for the DPG apps #20

Closed
opened 2026-10-10 12:22:21 +02:00 by midas · 1 comment
Owner

Part of #16.

Goal

Decide the shape of the tracking patches before implementing the per-SDK issues:

  • patch name(s) and options;
  • what is shared between de Volkskrant (Edition) and De Gelderlander (Kubus);
  • how the consent flow stays intact.

What we know

The two platforms dispatch tracking very differently. A shared dpg/tracking patch only makes sense for the parts that really are the same SDK.

de Volkskrant (7.52.0)

  • The central dispatcher is nl.persgroep.edition.domain.analytics.events.tracking.AnalyticsDispatcherImpl.
    • track() routes both Firebase and Usabilla events.
    • Events queue in memory until updateConsent(marketing, cim) is called.
  • Firebase logEvent is the bus for everything else. The Google Tag Manager container assets/containers/GTM-KQGZHLB.json forwards Firebase events to custom tags:
    • Snowplow (be.persgroep.tracking.TrackingEventsTransmitter);
    • comScore (ComscoreEventTransmitter);
    • CIM.
  • Contentsquare is enabled only for Volkskrant. CIM/Gemius is a no-op there (CimTrackerNoop).

De Gelderlander (9.21.1)

  • The central dispatcher is ch (AnalyticsService, anchor "com.kubusapp.analytics.AnalyticsService$trackQualitativeReach$1$1"). It holds a static set of strategies.
    • There are only two strategies: n24 (Firebase) and omd (Usabilla).
  • g9d (TrackingStarter) does several things at runtime:
    • re-enables Firebase Analytics, even though the manifest sets firebase_analytics_collection_enabled=false;
    • forces Crashlytics on;
    • starts comScore;
    • sets up Facebook.

Shared between the apps

  • DPG's Snowplow SDK (be.persgroep.tracking.config.InitConfigHandler, unobfuscated in Volkskrant).
  • Firebase Analytics and Crashlytics.
  • Usabilla.
  • Manifest auto-init providers: Facebook and Piano/Cxense CxSdkInitializer.

Questions to answer

  • One named patch Disable tracking with a boolean option per SDK, or several named patches?
    • Options make Manager's UI busier.
    • Options do let users keep, for example, Crashlytics.
  • Which hooks are identical across both apps, so they can live under dpg/?
    • Snowplow InitConfigHandler?
    • Usabilla SDK sendEvent?
    • Manifest edits as a resource patch?
  • Consent safety: the consent dialog (be.dpgmedia.privacy) must still appear and store the choice.
    • Ads, Pinch opt-out ads and marketing templates read consent.
    • Don't stub ConsentManager.
  • Volkskrant: if track() becomes a no-op, make sure the dispatcher's queue can't grow without limit.
  • Does any hook break a logged-in feature?
    • Snowplow carries user IDs.
    • userProfileSynchronizer runs from the ad startup task.

Deliverables

  • A "Tracking" section in both docs/apps/*.md.
  • A decision comment on this issue; the per-SDK issues in #16 then follow it.

Midas Settings

Proposed default:

  • Tracking SDKs get no Midas Settings toggle. They are disabled whenever the tracking patch is included. Most of them initialise at startup, and a "track me again" switch has little value.
  • The only exception is Crashlytics (#31), which gets a toggle because crash reports have a legitimate use.
  • Decide here whether per-SDK toggles (restart required) are wanted after all.
Part of #16. ## Goal Decide the shape of the tracking patches before implementing the per-SDK issues: - patch name(s) and options; - what is shared between de Volkskrant (Edition) and De Gelderlander (Kubus); - how the consent flow stays intact. ## What we know The two platforms dispatch tracking very differently. A shared `dpg/tracking` patch only makes sense for the parts that really are the same SDK. ### de Volkskrant (7.52.0) - The central dispatcher is `nl.persgroep.edition.domain.analytics.events.tracking.AnalyticsDispatcherImpl`. - `track()` routes both Firebase and Usabilla events. - Events queue in memory until `updateConsent(marketing, cim)` is called. - Firebase `logEvent` is the bus for everything else. The Google Tag Manager container `assets/containers/GTM-KQGZHLB.json` forwards Firebase events to custom tags: - Snowplow (`be.persgroep.tracking.TrackingEventsTransmitter`); - comScore (`ComscoreEventTransmitter`); - CIM. - Contentsquare is enabled only for Volkskrant. CIM/Gemius is a no-op there (`CimTrackerNoop`). ### De Gelderlander (9.21.1) - The central dispatcher is `ch` (AnalyticsService, anchor `"com.kubusapp.analytics.AnalyticsService$trackQualitativeReach$1$1"`). It holds a static set of strategies. - There are only two strategies: `n24` (Firebase) and `omd` (Usabilla). - `g9d` (TrackingStarter) does several things at runtime: - re-enables Firebase Analytics, even though the manifest sets `firebase_analytics_collection_enabled=false`; - forces Crashlytics on; - starts comScore; - sets up Facebook. ### Shared between the apps - DPG's Snowplow SDK (`be.persgroep.tracking.config.InitConfigHandler`, unobfuscated in Volkskrant). - Firebase Analytics and Crashlytics. - Usabilla. - Manifest auto-init providers: Facebook and Piano/Cxense `CxSdkInitializer`. ## Questions to answer - [ ] One named patch **Disable tracking** with a boolean option per SDK, or several named patches? - Options make Manager's UI busier. - Options do let users keep, for example, Crashlytics. - [ ] Which hooks are identical across both apps, so they can live under `dpg/`? - Snowplow `InitConfigHandler`? - Usabilla SDK `sendEvent`? - Manifest edits as a resource patch? - [ ] Consent safety: the consent dialog (`be.dpgmedia.privacy`) must still appear and store the choice. - Ads, Pinch opt-out ads and marketing templates read consent. - Don't stub `ConsentManager`. - [ ] Volkskrant: if `track()` becomes a no-op, make sure the dispatcher's queue can't grow without limit. - [ ] Does any hook break a logged-in feature? - Snowplow carries user IDs. - `userProfileSynchronizer` runs from the ad startup task. ## Deliverables - [ ] A "Tracking" section in both `docs/apps/*.md`. - [ ] A decision comment on this issue; the per-SDK issues in #16 then follow it. ## Midas Settings Proposed default: - Tracking SDKs get **no** Midas Settings toggle. They are disabled whenever the tracking patch is included. Most of them initialise at startup, and a "track me again" switch has little value. - The only exception is Crashlytics (#31), which gets a toggle because crash reports have a legitimate use. - Decide here whether per-SDK toggles (restart required) are wanted after all.
Author
Owner

## Tracking Architecture & Design Decisions

Investigation across the decompiled codebases (e.persgroep.android.news.mobilevk 7.52.0 and com.mecom.gelderlander.nl 9.21.1) is complete. The tracking architecture has been documented in docs/apps/volkskrant.md and docs/apps/gelderlander.md.

1. Patch shape & naming

  • One named patch per app: "Disable tracking" (disableTrackingPatch), default = true, without compile-time Morphe Manager options.
  • Why no compile-time options: Most trackers (Snowplow, Contentsquare, comScore, Facebook, Firebase Analytics, dormant manifest providers) should always be shut down when a user picks "Disable tracking". Adding boolean options clutters the Morphe Manager UI.
  • Crashlytics (#31): Instead of a Morphe Manager option, Crashlytics gets an in-app runtime toggle in Midas Settings (Crashrapporten uitschakelen / disable_crash_reports, default off). This lets users keep crash reporting on for stability reports without requiring a rebuild/repatch.

2. What is shared across apps (dpg/)

  • DPG Snowplow SDK (e.persgroep.tracking) (#29):
    • Completely unobfuscated in both apps.
    • Architecture and classes (InitConfigHandler, SnowplowInitializer, TrackingSDK) are identical.
    • Can live under
      l.midasvo.patches.dpg.tracking.disableSnowplowPatch (unnamed, depended on by each app's disableTrackingPatch).
    • Hook point: return an empty list in InitConfigHandler.createTrackingConfigs(InitConfig), preventing TrackingConfig.Snowplow and SnowplowManager creation while keeping the handler constructible and setConsent callable.
  • Crashlytics hook (#31):
    • Unobfuscated FirebaseCrashlytics.setCrashlyticsCollectionEnabled(boolean) can be intercepted in a shared hook or per-app hook tied to the Midas Settings toggle.
  • Manifest cleanup (#32):
    • Both apps contain com.facebook.internal.FacebookInitProvider and io.piano.android.cxense.CxSdkInitializer under ndroidx.startup. Volkskrant also bundles unused Heap providers. Stripped via resource patches.
  • Do not touch ConsentManagerImpl or PrivacyConsentTCF2Activity:
    • The consent flow (e.dpgmedia.privacy / PrivacyGateSdk) runs independently and stores IAB TCF 2.2 consent preferences into SharedPreferences.
    • Ads and templates check these preferences (getTcString()).
    • The consent dialog will continue to appear and save user choices normally.

4. Volkskrant queue safety (#27)

  • In AnalyticsDispatcherImpl.track(TrackingEvent): return early when data instanceof FirebaseTrackingEvent.
  • This ensures rackingEventsQueue never accumulates events in memory before consent is given.
  • When updateConsent() runs, sendPendingEvents() finds an empty queue and finishes immediately.
  • In FirebaseTracker.updateConsent(): force setAnalyticsCollectionEnabled(false).

5. Login & user profile safety

  • In Volkskrant, userProfileSynchronizer.updateUserIds() only writes external IDs (PW_ID, GIGYA_ID) to e.persgroep.advertising.userprofile.base.IdManager for ad targeting.
  • App authentication and paywall verification use AuthRepository (Gigya) and backend session tokens, which are completely decoupled from Snowplow, Firebase, and IdManager. Disabling tracking does not break user login or profile features.

Implementation roadmap for tracking sub-issues:

  • #26 (Volkskrant: Contentsquare): Return alse from TrackingModule.provideContentsquareEnabled.
  • #27 (Volkskrant: Firebase & GTM): Return early for FirebaseTrackingEvent in AnalyticsDispatcherImpl.track, disable collection in FirebaseTracker.updateConsent.
  • #28 (Gelderlander: Dispatcher & Firebase): Skip registering
    24 in g9d.g(), prevent ch.r(true) from enabling collection, or drop in
    24.a/
    24.c.
  • #29 (Both: Snowplow SDK): Unnamed shared patch dpg/tracking/disableSnowplowPatch hooking InitConfigHandler.createTrackingConfigs.
  • #30 (Gelderlander: comScore): Force FEATURE_COMSCORE to "disabled" and/or no-op com.comscore.Analytics.start(Context).
  • #31 (Both: Crashlytics): Midas Settings toggle disable_crash_reports (default off) hooking setCrashlyticsCollectionEnabled.
  • #32 (Both: Dormant SDKs): Resource patch stripping FacebookInitProvider and CxSdkInitializer from AndroidManifest.xml, skip Facebook init block in g9d.f().
## Tracking Architecture & Design Decisions Investigation across the decompiled codebases (e.persgroep.android.news.mobilevk 7.52.0 and com.mecom.gelderlander.nl 9.21.1) is complete. The tracking architecture has been documented in docs/apps/volkskrant.md and docs/apps/gelderlander.md. ### 1. Patch shape & naming - **One named patch per app: "Disable tracking"** (disableTrackingPatch), default = true, without compile-time Morphe Manager options. - **Why no compile-time options:** Most trackers (Snowplow, Contentsquare, comScore, Facebook, Firebase Analytics, dormant manifest providers) should always be shut down when a user picks "Disable tracking". Adding boolean options clutters the Morphe Manager UI. - **Crashlytics (#31):** Instead of a Morphe Manager option, Crashlytics gets an in-app runtime toggle in Midas Settings (**Crashrapporten uitschakelen** / disable_crash_reports, default off). This lets users keep crash reporting on for stability reports without requiring a rebuild/repatch. ### 2. What is shared across apps (dpg/) - **DPG Snowplow SDK (e.persgroep.tracking) (#29):** - Completely unobfuscated in both apps. - Architecture and classes (InitConfigHandler, SnowplowInitializer, TrackingSDK) are identical. - Can live under l.midasvo.patches.dpg.tracking.disableSnowplowPatch (unnamed, depended on by each app's disableTrackingPatch). - Hook point: return an empty list in InitConfigHandler.createTrackingConfigs(InitConfig), preventing TrackingConfig.Snowplow and SnowplowManager creation while keeping the handler constructible and setConsent callable. - **Crashlytics hook (#31):** - Unobfuscated FirebaseCrashlytics.setCrashlyticsCollectionEnabled(boolean) can be intercepted in a shared hook or per-app hook tied to the Midas Settings toggle. - **Manifest cleanup (#32):** - Both apps contain com.facebook.internal.FacebookInitProvider and io.piano.android.cxense.CxSdkInitializer under ndroidx.startup. Volkskrant also bundles unused Heap providers. Stripped via resource patches. ### 3. Consent safety - **Do not touch ConsentManagerImpl or PrivacyConsentTCF2Activity**: - The consent flow (e.dpgmedia.privacy / PrivacyGateSdk) runs independently and stores IAB TCF 2.2 consent preferences into SharedPreferences. - Ads and templates check these preferences (getTcString()). - The consent dialog will continue to appear and save user choices normally. ### 4. Volkskrant queue safety (#27) - In AnalyticsDispatcherImpl.track(TrackingEvent): return early when data instanceof FirebaseTrackingEvent. - This ensures rackingEventsQueue never accumulates events in memory before consent is given. - When updateConsent() runs, sendPendingEvents() finds an empty queue and finishes immediately. - In FirebaseTracker.updateConsent(): force setAnalyticsCollectionEnabled(false). ### 5. Login & user profile safety - In Volkskrant, userProfileSynchronizer.updateUserIds() only writes external IDs (PW_ID, GIGYA_ID) to e.persgroep.advertising.userprofile.base.IdManager for ad targeting. - App authentication and paywall verification use AuthRepository (Gigya) and backend session tokens, which are completely decoupled from Snowplow, Firebase, and IdManager. Disabling tracking does not break user login or profile features. ### Implementation roadmap for tracking sub-issues: - **#26** (Volkskrant: Contentsquare): Return alse from TrackingModule.provideContentsquareEnabled. - **#27** (Volkskrant: Firebase & GTM): Return early for FirebaseTrackingEvent in AnalyticsDispatcherImpl.track, disable collection in FirebaseTracker.updateConsent. - **#28** (Gelderlander: Dispatcher & Firebase): Skip registering 24 in g9d.g(), prevent ch.r(true) from enabling collection, or drop in 24.a/ 24.c. - **#29** (Both: Snowplow SDK): Unnamed shared patch dpg/tracking/disableSnowplowPatch hooking InitConfigHandler.createTrackingConfigs. - **#30** (Gelderlander: comScore): Force FEATURE_COMSCORE to "disabled" and/or no-op com.comscore.Analytics.start(Context). - **#31** (Both: Crashlytics): Midas Settings toggle disable_crash_reports (default off) hooking setCrashlyticsCollectionEnabled. - **#32** (Both: Dormant SDKs): Resource patch stripping FacebookInitProvider and CxSdkInitializer from AndroidManifest.xml, skip Facebook init block in g9d.f().
midas closed this issue 2026-10-10 14:53:15 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midas/midas-patches#20
No description provided.