Google Analytics in Godot

2 minute read

I struggled to find a Godot 4.2 plugin that provides Google Analytics. There’s a Firebase one which uses Rest APIs and has every Firebase API except Analytics, there’s one from Godot 2, there’s another one from Godot 3.5.

So I started to write my own plugin. But I’m lazy. So I decided to try once more.

You will always solve a hard problem exactly when you need to solve it and no earlier.

So I struggled again installing every candidate plugin, used all of them and then failed in every possible way. I am now happy to announce that I’m finally able to use Google Analytics from Godot 4.2 on a Quest 3, and I didn’t have to write a line of code.

Google Analytics Screenshot

Here you go

Note 1: Do not install the version on the Godot Asset store because it fails to work without the most recent patch from GitHub.

Note 2: I did have to modify one part of it.

I’m not comfortable releasing a version on GitHub, and since I’m lazy I don’t really want to be on the hook for maintaining my own fork.

For some reason it’s not picking up the gradle_build/use_gradle_build option in my build rule for Meta Quest, so I ended up just… commenting it out and it works.

func _supports_platform(platform):
		if platform is EditorExportPlatformAndroid:
			# ok but I do use grudle build
			# if not get_option("gradle_build/use_gradle_build"):
			# 	push_warning("Firebase Analytics not added cause you don't use grudle build")
			# 	return false
			if not FileAccess.file_exists("res://android/build/google-services.json"):
				push_warning("Firebase Analytics not added cause file res://android/build/google-services.json not founded")
				return false
			return true
		return false

Updated: