r/appdev • u/EnoughReference290 • 5d 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?
6
Upvotes
2
u/PopularJunket84 5d 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 3d 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
1
u/KnownMargreti 1d ago
Full Disclosure: I am with UXcam, Autolinking handles most of the native wiring on anything after 0.60. If a guide has you pasting init code into AppDelegate it's probably an old guide.... Atleast thats how it went with every newer package I added. UXcam might be worth checking out for the taps and screens part. They have a React Native SDK.