Skip to main content

What LinkedIn's iOS Analytics Rewrite Teaches Mobile Teams

· Do Minh Tuan · Developer Corner 💻

What LinkedIn's iOS Analytics Rewrite Teaches Mobile Teams

LinkedIn's iOS team reportedly rebuilt the way its app reports analytics. Instead of walking the UIKit view tree to work out what a user tapped, the system asks each component to describe itself through a shared contract the engineers call a MeasurableNode. InfoQ wrote it up in November.

The detail is theirs, but the pattern is the interesting part. I suspect many apps share the same quiet problem: the numbers in the dashboard do not match what the product team knows happened. Nobody files a bug, because nothing crashed. The mismatch just sits there and slowly makes every decision slightly worse.

Why the view tree stops matching the product

Most mobile analytics code was written when a screen was one tree of views. Each view had an identifier, and you found out what was tapped by walking up the tree. That worked because the visual hierarchy and the logical hierarchy were the same thing.

They are not the same thing any more. SwiftUI, container view controllers, embedded child controllers, recycled cells, overlay layers and design system wrappers mean the thing a user calls a card might be assembled from several unrelated subtrees. Some are hosted in a different framework entirely. A tap can land on a view whose nearest identifiable ancestor is a generic container, not the product concept anyone cares about.

The symptoms are familiar: events attributed to the wrong component, missing parameters, the same event firing twice because a cell was reused, and an argument between product and analytics that never really resolves.

LinkedIn's answer was to separate measurement from rendering. A component declares what it is, for example a job card in a feed, along with the data it carries. The analytics walker then traverses that graph of declared components instead of the UIView graph. Swap UIKit for SwiftUI underneath and the description still holds.

The three separations that matter

The write-up describes three splits, and they are the clearest part of the design.

Identity is separate from hierarchy. A component knows it is a job card because of what it holds, not because of where it sits. That is also the fix for cell reuse. If measurement is tied to the cell instance, one cell emits events for five different items over its life. Bind identity to the data model instead and the problem goes away, though it takes discipline in every list you write.

Measurement is separate from rendering. The analytics layer asks a component for its measurable description rather than digging through subviews. Changing the renderer does not change the report.

Collection is separate from transport. Events get assembled into a normalised form and handed to whatever pipeline ships them. Adding a second vendor or moving to a new one does not touch product code.

Parent containers aggregate their children's descriptions, and the walker follows that product graph.

Where teams get stuck

Three things trip teams up.

Reuse and identity, as above. That touches every table and collection view in the app.

Aggregation boundaries. A feed item has a header, a body, a footer and three buttons. Someone has to decide which node owns the event and stop a child and parent double counting. The usual rule is that the most specific measurable node owns the event and its ancestors only add context. Write that down, because it will otherwise be decided differently by two developers.

Cross-framework hosting. SwiftUI inside UIKit and the reverse is normal now. A contract handles it well because it does not care which framework produced the node, but both sides have to implement it instead of poking at the hosting controller.

Then there is governance, which is where budgets run out. A contract needs a schema, versioning, review for new node types, and tests that assert the payloads. That is real work, and the part nobody scopes.

Given all that, the only realistic path is staged. You rarely get to rebuild analytics, so I would start small.

First, agree on the vocabulary before writing any code. Screens, modules, items, actions. Write the names down in one place. I would guess more analytics arguments come from two teams naming the same button differently than from any technical bug, and no architecture fixes that.

Second, introduce a minimal contract. An identifier, a type, and a typed set of properties is enough to prove the pattern. Two or three node types on your busiest screens will tell you if it works.

Third, build the walker with explicit rules for nearest-owner attribution and duplicate suppression, and unit test it against synthetic trees. That is where correctness lives.

Fourth, migrate screen by screen. Keep the old path behind a flag, compare old and new events, then delete the old instrumentation. Shadow comparison is the cheapest way to find attribution bugs before an analyst does.

Fifth, add guardrails. Schema validation in CI, a lint rule that flags analytics calls made straight from view code, and a short checklist for new measurable types.

A small team can get the contract, walker and first few screens done in a few weeks. The rest is a long tail, and I would schedule it as maintenance rather than pretend it is a project with an end date.

The same problem shows up in Vietnam. The country has become a serious delivery hub for mobile work, especially for clients in Japan, Singapore, Australia and South Korea. Much of that is feature delivery on apps the client already owns, with the analytics stack in place.

Analytics correctness is turning into a procurement question. Clients burned by unreliable dashboards now ask vendors to show how they instrument and test measurement code. A team that can talk about contracts and attribution rules stands out against one that only talks about shipping screens.

Vietnamese companies building their own consumer apps, fintech products and super-app platforms hit the same problem, with fast-moving UI layers and business teams that need numbers they can defend. Someone who has built a semantic measurement layer has a skill that transfers anywhere.

The honest gap is depth. The iOS pool here is strong on UIKit and stronger on SwiftUI, but analytics architecture, data contracts and schema governance are thinner, because those decisions sat with clients abroad. That is an opening for developers moving from building screens to designing systems, and a risk for employers who assume the skill is already in the room.

So if I were judging a team on this, I would stop asking which analytics SDK it uses. The answer tells me almost nothing. I would ask how they attribute an event to a logical component when the view hierarchy does not match the product hierarchy, and whether they have unit tests on the event assembly layer.

I would also put analytics in the definition of done. If the contract lists screens and APIs but not measurement, measurement is the first thing cut when the schedule slips.

The opposite failure is over-engineering: building a grand unified measurement framework before shipping anything.

LinkedIn's design is interesting mostly because of what it implies for everything else. As rendering gets more compositional, any concern that inspects the view tree gets fragile. Analytics is the obvious case, but accessibility, deep linking and UI testing have the same shape. Put a semantic layer over the product, let the implementation change underneath, and pay for the governance that keeps the layer honest.

The question I would still ask is who owns the event schema on the client side, and what happens when a product manager wants a new event next week. If the answer is nobody, the architecture will not save you, and my bet is that is the usual answer.

Written with AI assistance, reviewed and edited by Do Minh Tuan.