googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BundleID and ProductName should be taken from the runtime Application class

AdriaandeJongh opened this issue · comments

With different bundle identifiers and localised product names, it's more than annoying that I have to set the BundleID, ProductName, and BundleVersion variables every time I compile for a different target. Instead of variables, both BundleID and ProductName currently have runtime variables that can and should be used instead:

http://docs.unity3d.com/ScriptReference/Application-bundleIdentifier.html
http://docs.unity3d.com/ScriptReference/Application-productName.html

There is currently no way to get the bundle version at runtime (which is stupid on Unity's behalf), but that should ideally also come from the PlayerSettings instead of having to be set manually on the GoogleAnalytics prefab.

Yes is annoying, we had to slightly alter the GA C# class so it takes the params from our config files, at runtime.

This cannot be done blindly in the case of BundleID. In standalone targets, Application.bundleIdentifier is not user defined, but rather identifies the unity build itself. That's not suitable for Analytics API bundleID, which maps to the "App ID" in the Analytics service. App ID should identify my app, not unity.

We've implemented it ourselves too as it's a real pain having to change version ids in four different places, especially during development builds where we're making alot of builds for testing for our ios/android/windows mobile game.

It would be easy to make this a mobile specific patch using platform dependent compilation:

#if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID || UNITY_WP_8 || UNITY_WP_8_1)
    //pull values from Application
#endif