How to Extract Analytics Data from Your iOS Application
Article Summary
Arsen Gasparyan from Revolut breaks down how to build an analytics system that's actually testable. Most teams bolt on tracking as an afterthought—here's the protocol-oriented approach that scales.
Revolut's iOS team needed a way to track user behavior across multiple analytics platforms (Google Analytics and Amplitude) without creating a maintenance nightmare. This article walks through their Swift implementation using protocols and enums to create a flexible, testable analytics layer.
Key Takeaways
- Protocol-based architecture lets you swap analytics providers without touching business logic
- Enum with associated values maps events to identifiers and properties cleanly
- Dummy provider pattern enables unit testing of analytics without real API calls
- Single client forwards events to multiple platforms simultaneously
- Setup happens once in didFinishLaunchingWithOptions, then track anywhere
A protocol-oriented analytics wrapper gives you multi-platform tracking, full test coverage, and zero vendor lock-in.
About This Article
Revolut's iOS team had to track user behavior across Google Analytics and Amplitude while keeping the code flexible, reliable, and testable. They also wanted to avoid getting locked into any single vendor.
Arsen Gasparyan's team built a protocol-oriented architecture. They created a TrackingEventType protocol, added provider classes for each analytics system, and set up a TrackingClient that sends events to all providers at once.
The dummy provider pattern made it possible to test analytics events without calling real APIs. Developers could check what events were tracked by looking at an exposed events property on TestTrackingClient.