Analytics with Swift: A comprehensive guide

Learn how to use analytics in Swift for your iOS apps and use App Store Connect!

An App Store Connect logo in front of a blurred image of an brightly lit work desk. At the right corner of the App Store Connect logo is the Swift Logo.

For iOS developers collecting and analyzing user data is as important as providing a privacy-friendly user experience. Since iOS is build with many privacy-related features for their users, it’s natural to implement your own app in a privacy-first mindset. In this article we will go into detail about iOS analytics, Swift analytics features, and how to seamlessly integrate third-party analytics software like TelemetryDeck into your Swift-based iOS applications.

The Importance of Analytics in iOS

Analytics in iOS applications serve many purposes, allowing not only developers, but product managers, and business analysts alike to gain insights into user behavior, app performance, and engagement.

1. Swift App Analytics with App Store Connect

Apple provides their own analytics software with App Store Connect. Though it is very limited in its capability, making it insufficient for many. The metrics you get from App Store Connect are still useful and you should keep an eye on them!

  • App Store performance: Gives you insights on how people find your app (website links, in-app recommendations) or how it performs in the App Store while a user searches for it. You can also see total downloads, redownloads, and first-time downloads.
  • Marketing campaigns: Keeps track of your marketing campaigns across channels like social media, email, and paid advertising. With that you will have a better understanding about the spending per user and know which campaigns works out best for you.
  • App Clip performance: Gives you special insights on the App Clip feature about the used sources (NFC tags, Safari, App Clip Codes) and also gives you numbers about views, installations, sessions, crashes, and more.
  • In-app event performance: This metric gives you better insights on in-app events, like page views, reminder and notification data, and even more. All metrics can be viewed by territory, source type, device, etc.
  • App engagement and usage: These insights keep you in check if people continue to use your app, how many installations there are, how many active devices, and the number of sessions.
  • Paying users: Check out the number of unique paying users per day, week, or month. You can even filter them by source to have a better understanding how many users from which campaign, app, or website are contributing to your sales.
  • Pre-orders: Simply shows how many users have pre-ordered your app before it’s available for download in the App Store. You can also filter by territory, source type, etc.
  • Peer group benchmarks: With this relatively new feature you can compare your own app performance compared to similar apps on the App Store. Apps are put into groups based on their category, business model, and download volume.
App Store Connect dashboard with "my apps", "app analytics", "sales and trends", "payments", "users and access", and "agreements, tax, and banking" menus

2. Third-Party Analytics SDKs

For more advanced analytics and customization options, many developers turn to third-party analytics SDKs. Some popular choices for integrating third-party analytics into Swift-based iOS apps include:

  • Google Analytics for Firebase: Firebase offers a feature-rich suite of analytics tools, including event tracking and user segmentation. It supports Swift and can be integrated into iOS applications.
  • Mixpanel: Mixpanel provides user-centric analytics that enable you to track user actions and build user profiles for personalized experiences. It offers a Swift SDK for iOS app integration.
  • TelemetryDeck: TelemetryDeck focuses on privacy-friendly analytics and helps you track all relevant metrics without spying on your users. It offers a TelemetryDeck SDK for your Swift application for iOS, macOS, watchOS, tvOS, and visionOS.

3. Custom Analytics Integration

For developers looking for complete control over their analytics implementation, they can roll their own analytics. For this, they need to create some sort of server that receives and stores their analytics, and then send data to it.

On the Swift side, use URLSession (in the past people would use AlamoFire) to send network requests with analytics data to your server. (Also, local storage to cache data until it can be sent)

On the server side, use a database solution like Postgres or CouchDB, or a time-series database. Beware that hosting these database servers can be tricky because depending on your application’s usage and user numbers, a lot of data will accumulate, leading to server costs and administrative work.

Choosing your best option

Analytics in iOS apps, powered by App Store Connect, provide valuable insights that can help you make your app even better. Apples own solution gives you the insights you need for the Apple ecosystem, but might not be sufficient enough. That’s where third-party analytics tools come to play - the ability to collect, analyze, and act upon user data is a crucial aspect of modern app development.

Testimonial by the developer of Posture Pal: Jordi Bruin
Can't believe how easy and useful TelemetryDeck is. Love the dashboard customisation options. Looks like I'll be adding some analytics to some apps. – Jordi Bruin, Posture Pal

TelemetryDeck has been a great help when it comes to supporting, expanding, and improving App Store Connect analytics. By integrating analytics effectively you can improve user experiences, optimize performance, and make informed decisions while simultaneously prioritizing user privacy and growth and success of your iOS application.