• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android SOLVED: How to get Google Analytics working with ANDROID APP

D

Daniel Westberg

Guest
I'm trying to integrate Google Analytics with my GameMaker Studio 2 (GMS2) ANDROID Game project.
I have created a Google Analytics account. In Analytics admin, I created an account and property... in Property > Data Streams, I'm stuck at step 3 - SDK Setup instructions.

"Switch to the Project view in Android Studio to see your project root directory.
Move the google-services.json file you just downloaded into your Android app module root directory."

Since I have created my app in GameMaker Studio 2, I have not created an Android Studio project... I'm not even sure if I should use "Data Streams" to track my Android app with Google Analytics. I have been trying to follow this guide from YoYoGames:

It says I can break it down into the following steps
"
  • Create an Account
  • Create a Property
  • Create one or more Profiles
"
I guess I cannot create a Profile before I've completed the "Data Streams" part..?

It does not make any sense to me...
Should I follow some other guide, or am I just being stupid about it? šŸ˜¬šŸ˜…

I've been looking for different guides and instructions on how I can fix this for 10 days and spent endless hours trying to make it work... PLEASE! Someone with more knowledge than me, if you have any tips on how I can make it work, I would appreciate it a lot!
 
D

Daniel Westberg

Guest
So... I have put the (google-services.json) file in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\ProjectFiles [see image #1]
I have also added some lines in the (Project-level build.gradle) and in the (App-level build.gradle) [see image #2]

I found the (Project-level build.gradle) in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\RootFiles
I found the (App-level build.gradle) in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\ProjectFiles

I will try uploading my new version of the app to Play Store and see if Google Analytics reacts to any in-game activity.

FYI: "ProgramData" folder is not visible unless you have settings set to "Show hidden files and folders" in Windows.
And put the google-services.json file in your current runtime version folder\android\runner\ProjectFiles (you can see your current runtime in top right corner in GMS2).
 

Attachments

Last edited by a moderator:
D

Daniel Westberg

Guest
It works!! So, that's how you can do it! Finally. I'll leave this up, if anyone needs it.
 

salyossy

Member
But which extention do you use?

I don't understand this. All extensions expect me to provide a tracking id, which is generated only for "web" property, not "app" property.

I'm trying to figure out the next step to connect with Google Analytics.

Any help is appreciated.
 

Toxic Tom

Member
So... I have put the (google-services.json) file in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\ProjectFiles [see image #1]
I have also added some lines in the (Project-level build.gradle) and in the (App-level build.gradle) [see image #2]

I found the (Project-level build.gradle) in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\RootFiles
I found the (App-level build.gradle) in: C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.2.5.378\android\runner\ProjectFiles

I will try uploading my new version of the app to Play Store and see if Google Analytics reacts to any in-game activity.

FYI: "ProgramData" folder is not visible unless you have settings set to "Show hidden files and folders" in Windows.
And put the google-services.json file in your current runtime version folder\android\runner\ProjectFiles (you can see your current runtime in top right corner in GMS2).

Hello I have put my google-services.json in the location you suggested (note I am using OSX):
/Users/Shared/GameMakerStudio2/Cache/runtimes/runtime-2023.4.0.113/android/runner/ProjectFiles

But during build I am getting this error:
System.IO.IOException: The target file '/Users/tom/.config/GameMakerStudio2/Cache/GMS2CACHE/Block_Boi_5F693B15/Android/Default/com.toxictom.blockboi/google-services.json' is a directory, not a file.

Looking at the file location mentioned in the error, there is indeed a directory 'google-services.json' getting generated by GameMaker, which appears to contain my entire game project file :oops:

Any idea what this means?
 
Top