I am trying to get the automatically set Analytics clientId in Android. (Setting it is explained in the Android API documentation as setClientId()
)
When I try to use tracker.get("clientId")
it returns empty. Any idea anyone?
Thanks in advance!
I am trying to get the automatically set Analytics clientId in Android. (Setting it is explained in the Android API documentation as setClientId()
)
When I try to use tracker.get("clientId")
it returns empty. Any idea anyone?
Thanks in advance!
I've ran a decompiler on it for you and it seems like the clientId property is stored with the key "&cid".
Internally it does this:
The solution would be to call this:
The get() method does however have special logic for the client ID key. It might also return a newly generated key or throw an
InterruptedException
like "ClientId loading or generation was interrupted" or anExecutionException
"Failed to load or generate client id"You can solve these kinds of issues yourself in Android Studio (or IntelliJ IDEA) by installing the "Java Bytecode Decompiler" or "Java Decompiler IntelliJ Plugin" plugins. This allows you to find the Tracker.class symbol and view it as if it was a Java regular file.