1

I am trying to implement Google Analytics to my app. I can see hits when trying on Unity editor and also see real time users in analytics dashboard. However when I build my game on device I cannot see users on real time. I wait for a day no data has been sent from device.

    try {

        googleAnalytics.LogScreen(new AppViewHitBuilder()
            .SetScreenName("Main Menu"));;

        debuggerText.text = "Succes";
    } catch (System.Exception ex) {
        debuggerText.text = ex.ToString();

    }

This return success both on desktop and device but on device no data sent. I search all similar questions but nothing helps ? Any idea what am I doing wrong ?

Çağatay Kaya
  • 417
  • 1
  • 6
  • 19
  • Is there anything in the logs? – Taras Leskiv Apr 15 '16 at 11:35
  • Where can I check the logs when building on device ? On desktop in console it show succesfully sent hits to google analytics. – Çağatay Kaya Apr 15 '16 at 11:52
  • do your homework http://developer.android.com/tools/help/logcat.html, check the logs on your Android device the moment you are sending the log – Taras Leskiv Apr 15 '16 at 11:58
  • find the logs. Here 04-15 16:02:09.657: E/GMPM(12430): GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin. – Çağatay Kaya Apr 15 '16 at 13:02

2 Answers2

1

This can happen if you have a white-space or new line in your tracking code.

I suggest you first delete your current tracking code from Unity. Now, copy your tracking code from Google/web to notepad then copy it directly from notepad to Unity. This will make sure that you don't have white-space or new line in your tracking code while copying it from the web.

Programmer
  • 121,791
  • 22
  • 236
  • 328
1

find the logs. Here 04-15 16:02:09.657: E/GMPM(12430): GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.

Now when you have read the logs you have to fix the cause: Missing an expected resource: 'R.string.google_app_id'

Here is GoogleService failed to initialize the solution.

Community
  • 1
  • 1
Taras Leskiv
  • 1,835
  • 15
  • 33