# App Architecture: Analytics

DevFeed: [App Architecture: Analytics](<https://devfeed.tech/articles/app-architecture-analytics-103675.md>)

Original publisher: [Read original article](<https://proandroiddev.com/app-architecture-analytics-ec3471ca619b?source=rss----c72404660798---4>)

Author: Mkhytar Mkhoian

Published: 2026-10-27T23:25:11Z

Content type: article

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [architecture-components](<https://devfeed.tech/topics/architecture-components.md>), [product analytics](<https://devfeed.tech/topics/product-analytics.md>), [Dependency Inversion](<https://devfeed.tech/topics/dependency-inversion.md>), [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [adapter pattern](<https://devfeed.tech/topics/adapter-pattern.md>), [async](<https://devfeed.tech/topics/async.md>)

Tags: [analytics](<https://devfeed.tech/tags/analytics.md>), [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [app-architecture](<https://devfeed.tech/tags/app-architecture.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>)

## AI overview

The article proposes keeping analytics vendors out of feature code: features emit app-defined events and user properties, while vendor-specific factories map events and trackers call SDKs. A dispatcher forwards calls off the main thread so one vendor's crash does not prevent others from receiving an event. In modular apps, features own their events and factories, DI collects them, and only the app module sees the full graph. The approach aims to avoid a central analytics god object, isolate vendor changes, preserve parameter types, and give ViewModels small interfaces that are easy to test. The author says the open-source Herald library implements this design.

## Source excerpt

Photo by Hunter Harritt on Unsplash It's been a while since the last time I covered app architecture topics. Today I am back with a new one. This time it's analytics and everything around it. The problem We engineers often treat analytics as a secondary piece of software. We spend so much time on the architecture design of the main parts and so little on designing analytics as part of the program that it always leads to a bad cocktail. This cocktail brings a bad smell to the code, some workarounds, and forces us to make exceptions to the architecture rules. In practice, developers spend time thinking about general architecture; no one thinks about analytics at that moment. Then business comes and asks to track this and that. Send a couple of events to a third-party analytics vendor, and devs start thinking about how to do that and integrate analytics. After some time, business asks to add more events for a new vendor. Now you need to not only track it, but also manage vendors and decide which event goes where. In code, it looks like one AnalyticsRepository or AnalyticsManager class that contains all analytics-related stuff, a huge list of methods where each of them calls due to tracking events. A god object class engineers drag across the codebase and make different components and layers depend on it. And here we are, holding a bad cocktail in our hand. The idea So how to stop making this cocktail? I came to a simple idea: the app should not know which analytics vendors exist. Feature code doesn't need to care if an event goes to Firebase, Mixpanel, AppsFlyer or all of them. It should only say what happened, in the app's own words. "Ticket purchased", "Settings screen opened". Where the event goes and in what format each vendor wants it is a different job, and it should live in a different place. Instead of one god object that knows everything, let's split the work into small pieces, and each piece has one job: The Event Event describes what happened, in the app's w