Adding private analytics with TelemetryDeck: Quick Start

Quick look at how to add and use TelemetryDeck SDK to your Swift app.

Published: Oct. 25, 2022
App Store

I have recently decided to try TelemetryDeck for the first time in my SwitchBuddy app. I wanted to better understand how people use it and already got quite a few insights. For example the app has way more daily active users than I thought, also changing the in-app theme is popular, while changing the app icon not so much.

I understand that indie devs are very reluctant when it comes to analytics but if you don’t track specific users and only track general behavior, I don’t see any issues with that. It will help you build better apps - because you know which apps are used and you can better focus your development effort.

Account and bonus

Anyway, let’s get started. The first step is to register your free account and create “App” in the web dashboard. After you do this, you will get an AppID identifier to configure the SDK.

TIP: If you register via my referral link, we both get extra 100k monthly signals (as of October 2022) which will double your free usage. Pretty nice if you ask me.

SDK Configuration

Once you have the identifier, you can setup the SDK. In UIKit project do this in the AppDelegate in the didFinishLaunchingWithOptions.

Like this:

let configuration = TelemetryManagerConfiguration(appID: "YOUR-ID")
TelemetryManager.initialize(with: configuration)

For SwiftUI, create init for your main App object (if you haven’t already) and add the code above there.

Sending events

You are now ready to send analytics events (signals as TelemetryDeck calls them) from your app.

The most basic ones can look like this:

TelemetryManager.send("themesOpened")

You can also send additional data. Something like this:

TelemetryManager.send("themeChanged", with: ["theme": theme.name])

There is a limitation in that the keys and values need to be of type String. And that is it for the basic usage. Check out the GitHub page for more info.

Filip Němeček profile photo

WRITTEN BY

Filip Němeček @nemecek_f@iosdev.space

iOS blogger and developer with interest in Python/Django. Want to see most recent projects? 👀

iOS blogger and developer with interest in Python/Django. Want to see most recent projects? 👀