Skip to content

Some signals get sent even with analyticsDisabled config option #209

Closed
@daprice

Description

@daprice

If, in a SwiftUI lifecycle app, I add the following in the init() of the App

var config = TelemetryDeck.Config(appID: “redacted")
config.analyticsDisabled = true
TelemetryDeck.initialize(config: config)

I still occasionally see log messages like "Sending 1 signals leaving a cache of 0 signals”. It looks like this config option does avoid sending any signals when I call TelemetryDeck.signal(…). However, signals from TelemetryDeck.errorOccurred(…) and the internal TelemetryDeck.Session.started signal are still sent and show up on TelemetryDeck’s Recent Signals page.

My use case is that I have a toggle in my settings screen for users to opt out of analytics. Initializing TelemetryDeck with Config.analyticsDisabled seemed like an appropriate way to honor this without having to add a check everywhere that I send a signal.

Workaround

As an easy workaround, I just made a wrapper around TelemetryDeck that avoids calling TelemetryDeck.initialize(), .signal(…) or .errorOccurred(…) if it should be disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions