I want to install Google Analytics on Android and iOS platforms so that the app will automatically track data when it is built. Please help me with this issue.
I remember I used to do Mobile analytics the same way I did Web.
In summary:
- import the library in your highest component where you can read the pathname. For instance react-router has a hook for React
useLocation
that returns the pathname too. - Call the analytics function/hook every time your pathname changes with the pathname as a parameter (as per the syntax of the analytics framework you use). You can use something like this: analytics - npm but you can also use the google analytics without middleware.
- Create your own functions/hooks and export them for actions and other things that
you want to track (click on a button, play on a video, etc)
However please be aware of this
I use https://matomo.org/ in all my projects.