Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[Full Changelog](In progress)

### Sync Manager

- Added the `sync_settings.engine_toggled` metric for per-device syncing, which records each time the user toggles an individual sync engine on or off ([#7813](https://github.com/mozilla/application-services/pull/7813)).

# v162.0 (_2026-11-19_)

[Full Changelog](https://github.com/mozilla/application-services/compare/v161.0...v162.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,22 @@ object SyncTelemetry {

SyncSettings.save.record(extras)
}

/**
* Records a `sync_settings.engine_toggled` event when the user turns a single
* sync engine on or off.
*
* @param engine The name of the engine that was toggled (e.g. "bookmarks").
* @param enabled `true` if the engine was enabled, `false` if it was disabled.
* @param enabledCount The total number of enabled engines after the change.
*/
fun processEngineToggledTelemetry(engine: String, enabled: Boolean, enabledCount: Int) {
SyncSettings.engineToggled.record(
SyncSettings.EngineToggledExtra(
engine = engine,
enabled = enabled,
enabledCount = enabledCount,
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1296,4 +1296,23 @@ class SyncTelemetryTest {
assertEquals("bookmarks,tabs", events.elementAt(0).extra!!["enabled_engines"])
assertEquals("logins", events.elementAt(0).extra!!["disabled_engines"])
}

@Test
fun `checks received engine toggled telemetry when it should`() {
SyncTelemetry.processEngineToggledTelemetry("bookmarks", false, 3)
SyncTelemetry.processEngineToggledTelemetry("logins", true, 4)
val events = SyncSettings.engineToggled.testGetValue()!!
assertEquals(2, events.size)

assertEquals("sync_settings", events.elementAt(0).category)
assertEquals("engine_toggled", events.elementAt(0).name)
assertEquals("bookmarks", events.elementAt(0).extra!!["engine"])
assertEquals("false", events.elementAt(0).extra!!["enabled"])
assertEquals("3", events.elementAt(0).extra!!["enabled_count"])

assertEquals("engine_toggled", events.elementAt(1).name)
assertEquals("logins", events.elementAt(1).extra!!["engine"])
assertEquals("true", events.elementAt(1).extra!!["enabled"])
assertEquals("4", events.elementAt(1).extra!!["enabled_count"])
}
}
27 changes: 27 additions & 0 deletions components/sync_manager/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1055,3 +1055,30 @@ sync_settings:
description: |
A comma-delimited list of engines that were disabled by the user.
type: string

engine_toggled:
type: event
description: |
Records each time the user toggles an individual engine on or off.
bugs:
- https://mozilla-hub.atlassian.net/browse/SYNC-5532
data_reviews:
- https://github.com/mozilla/application-services/pull/7813#issuecomment-7025127713
data_sensitivity:
- interaction
notification_emails:
- sync-dev@mozilla.org
expires: never
extra_keys:
engine:
description: |
The engine that was enabled or disabled.
type: string
enabled:
description: |
The engine's enablement value, true if enabled and false if disabled.
type: boolean
enabled_count:
description: |
The total number of enabled engines after the change.
type: quantity