Search code examples
google-analyticsfirebase-analytics

How to get Google analytics client id for mobile app (not mobile websites)


In website (desktop or mobile), GA generates client_id and stores in _ga cookie. This I can easily retrieve using gtag.

For mobile app, do we have to generate & set client_id ourselves ? Because I cannot find related documentation for this. If we have to generate ourselves, can we use any uuid or Firebase app_instance_id as ga client id.


Solution

  • client id in gtag is equivalent to app instance id in firebase tracking id in gtag is equivalent to app id (or project id, idk) in firebase

    So answer is we can use app instance id of firebase as equivalent of client id.

    Similarity between two:

    • client id indicates a particular install (not technically) of a website. It remains unchanged for 2 years unless that website is hard-refreshed
    • app instance id also indicates a particular install of an app on phone and remains same till app in uninstalled