r/appdev • u/EnoughReference290 • 1d ago
Why does every analytics SDK want me to wire up iOS and Android separately in RN
I picked React Native so I'd write things once. Then I go to add analytics and I'm editing Podfiles and Gradle files and pasting init code into AppDelegate and MainApplication, and every guide wants me to write an event by hand for each button, it's a biiiit much.
I spent a whole weekend on it and Android still reports screen names that don't match iOS. I just want one JS setup that covers both platforms and picks up taps and screens without me naming every single one.
Anything like that for RN?
4
Upvotes
1
u/PopularJunket84 1d ago
Your screen names don't match because the native side is reading the activity and view controller names, and those differ per platform. Hook the navigation container's onStateChange and send the route name from JS. I did that on my last app and both platforms showed the same names in the dashboard.
1
u/TawrilAmreece77 17h ago
for the screen tracking part, hook into your navigation container's state change listener in JS instead of letting the native SDKs guess the view names. that way both platforms report the exact route names you already defined in your router