Integrating GameAnalytics remote config

#1

Anyone has a working example of running a AB Test experiment with GameAnalytics?

I’m confused as when to call
gameanalytics.isRemoteConfigsReady()

I’m also setting a listener, and fetching the data, but nothing is printed!

gameanalytics.setRemoteConfigsListener(function()
		print("GA Listener")
	end)
	local result = gameanalytics.getRemoteConfigsValueAsString({key="test1"})

Anyone got it working? Thanks for your help

0 Likes

#2

I don’t use this feature so I can’t comment on it.

Pinging @gameanalytics

0 Likes

#3

@totebo: You use GameAnalytics right?

0 Likes

#4

Hey! I use remote configs in my project. I haven’t done any a/b testing, though. We use it for pacing variables and to prompt the player to upgrade if they’re on a really old version.

The confusion is that if gameanalytics.isRemoteConfigsReady() returns true, the listener won’t trigger, unless you minimise the game and come back to it.

If isRemoteConfigsReady() returns false, the listener should fire without first leaving the game.

Whether it returns true or false can vary per device. I think it has something to do with which version of iOS or Android the player has.

3 Likes

#5

Hi,

I can see wht the issue now. Because the GA SDK is initialised immediately when the extension is being initialised then it will not get caught the first time probably because you are first setting the listener after the remote configs have been updated and will first work when you put the app to background and back into focus again. I think I will make an option in the game.project file so you can set manual_initialize = 1 to be able to manually initialize the SDK with gameanalytics.initialize() or something like that. Then you can call the initialize function the same place as you set the listener. I hope that makes sense. I will let you know when I have released a new version.

2 Likes

#6

I have updated the extension now (v.3.3.3) and have added manual initialize option. Info found here on how to use it: https://gameanalytics.com/docs/item/defold-sdk#configs

5 Likes

#7

Hi @gameanalytics, I’ve started using v3.3.4 and keep getting crashes on Android every 5th start or so.

I use manual_initialize = 1 in the config, then:

	gameanalytics.setRemoteConfigsListener( remote_configs_listener )
	gameanalytics.initialize()

Is this the correct way of using the latest init? I was getting the crashes before on v3.3.1 and was hoping updating would solve the problem.

The intermittent issue appears to happen in the callback. A few good values come through, then it crashes. Most of the time all values are returned and no error happens.

Update: I’ve removed the remote config Lua code for now and have had no crashes.

Logcat:

2020-10-16 16:26:02.413 19142-19177/com.winkelgames.juump D/defold: DEBUG:SCRIPT: remote_configs.load()	function: 0x77e68f5b60
2020-10-16 16:26:02.414 19142-19177/com.winkelgames.juump D/defold: DEBUG:SCRIPT: gameanalytics.isRemoteConfigsReady()
2020-10-16 16:26:02.414 19142-19177/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	false
2020-10-16 16:26:02.514 9035-7305/? W/NetworkScheduler: Error inserting flex_time=2562000 job_id=-1 period=5125000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=203915000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1602861962512 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0, error message: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) [CONTEXT service_id=218 ]
2020-10-16 16:26:02.558 19142-19177/com.winkelgames.juump E/defold: ERROR:PROFILER: Could not open /proc/stat
2020-10-16 16:26:03.897 1053-1053/? I/perfetto: probes_producer.cc:329  Producer stop (id=1477)
2020-10-16 16:26:03.900 1055-1055/? I/perfetto: ng_service_impl.cc:1948 Tracing session 1477 ended, total sessions:1
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: remote_config.map_keys()
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: valueWithCustomDefaultValue	3
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	Key: interstitial
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	old: ads, interstitial_frequency, 3
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	new: ads, interstitial_frequency, 3
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	---
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: valueWithCustomDefaultValue	1.42
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	Key: latest_build
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	old: general, latest_build, 1.63
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	new: general, latest_build, 1.42
2020-10-16 16:26:03.903 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	---
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: valueWithCustomDefaultValue	500
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	Key: unlockbiome2
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	old: biomes, 2, 500
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	new: biomes, 2, 500
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	---
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: valueWithCustomDefaultValue	300
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	Key: unlockbiome3
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	old: biomes, 3, 300
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	new: biomes, 3, 300
2020-10-16 16:26:03.904 19142-19204/com.winkelgames.juump D/defold: DEBUG:SCRIPT: 	---
2020-10-16 16:26:03.905 19142-19177/com.winkelgames.juump E/defold: ERROR:SCRIPT: Unbalanced Lua stack, expected (1), actual (3)
    
    
    --------- beginning of crash
2020-10-16 16:26:03.905 19142-19204/com.winkelgames.juump A/libc: ../src/script_hash.cpp:182: void dmScript::PushHash(lua_State *, dmhash_t): assertion "top + 1 == lua_gettop(L)" failed
2020-10-16 16:26:03.905 19142-19177/com.winkelgames.juump A/libc: ../src/script.cpp:1357: void dmScript::LuaStackCheck::Verify(int): assertion "expected == actual" failed
2020-10-16 16:26:03.905 19142-19177/com.winkelgames.juump A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 19177 (Thread-60), pid 19142 (nkelgames.juump)
2020-10-16 16:26:03.933 19142-19204/com.winkelgames.juump I/defold: INFO:CRASH: Successfully wrote Crashdump to file: /data/user/0/com.winkelgames.juump/files/_crash
2020-10-16 16:26:03.933 19142-19204/com.winkelgames.juump E/defold: ERROR:CRASH: CALL STACK:
    
    # 0 pc        0x5bc [vdso] <unknown>+0
    # 1 pc      0x13174 ...oid.runtime/lib64/bionic/libc.so abort+164
2020-10-16 16:26:03.947 876-876/? I/Zygote: Process 19142 exited due to signal 6 (Aborted)
2020-10-16 16:26:03.935 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/67: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/68: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/69: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/70: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/71: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/72: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/73: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/74: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/75: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/76: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/77: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/78: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/79: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/80: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/81: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/82: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/83: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/84: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/85: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/86: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/87: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/88: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/89: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/90: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/91: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/92: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/93: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/94: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/95: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/96: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/97: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/98: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/99: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/100: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/102: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/103: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/104: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/105: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/106: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/107: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/109: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/112: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/113: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/114: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/115: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/116: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/117: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/118: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/119: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/120: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? E/DEBUG: failed to readlink /proc/19177/fd/121: No such file or directory
2020-10-16 16:26:03.948 19227-19227/? A/crash_dump64: crash_dump.cpp:457] failed to get process threads: No such file or directory
2020-10-16 16:26:03.949 867-867/? I/tombstoned: received crash request for pid 19177
2020-10-16 16:26:03.948 1479-1479/? W/ActivityManager: type=1400 audit(0.0:17820): avc: denied { getpgid } for scontext=u:r:system_server:s0 tcontext=u:r:crash_dump:s0:c112,c257,c512,c768 tclass=process permissive=0 b/73128755
2020-10-16 16:26:03.948 1479-1479/? I/chatty: uid=1000(system) Binder:1479_3 identical 2 lines
2 Likes

#8

I’m seeing the same thing.

0 Likes

#9

Ok I will have a look at what goes wrong

1 Like

#10

I only got the crash once but I haven’t been able to reproduce it since. Have you figured out any pattern to when the crash is happening when using the remote configs listener?

0 Likes

#11

For me it happens every 5th start or so. It seems to happen when the app loses focus (which mine does because of Google Play authentication) around the same time as the initialize() happens.

1 Like

#12

How does your remote configs listener function look like?

0 Likes