googleanalytics / google-analytics-plugin-for-unity Goto Github PK
View Code? Open in Web Editor NEWGoogle Analytics plugin for the Unity game creation system
License: Apache License 2.0
Google Analytics plugin for the Unity game creation system
License: Apache License 2.0
I was getting this error (Error building Player: ArgumentNullException: Argument cannot be null. Parameter name: key) when trying to build for iOS (Unity PRO 4.6.3f1 and Xcode 6.1.1 / OSX 10.9.5).
I managed to "solve" the error after removing Google Analytics Plugin so - maybe - it's related to Google Analytics Plugin.
Maybe this solution : http://visionpunk.vanillaforums.com/discussion/1056/error-after-unity-install will help to find the error (if there's one)
Thanks
Fabio
Hi,
Just thought I'd let you all know of a problem we were facing:
The "hit request failed with error" warning is logged on platforms where WWW.responseHeaders
class does not contain "STATUS" even if the request is successful.
Not sure how to fix this, maybe check if request.error
is null or empty? Generally, I've found relying on WWW.responseHeaders
to be unreliable.
Thanks!
Hey,
great tool! It logs everything for iOS and Android.
But on WP8 and Blackberry (Real device), no hits has been sent. What I have to do to have GA on WP9 and BB aswell?
Is there a way to enable the "enableAdvertisingIdCollection" flag with this plugin?
Like described here
https://support.google.com/analytics/answer/2444872?hl=en
My game logs about 10-15 events per 20 seconds. It seems like only a few of them actually end up in the web interface of analytics.
What could be the reason for that?
I am getting a crash EXC_BAD_ACCESS when running on my iOS device via xcode. It looks like it is being raised on the "setSampleFrequency" call. I have my SampleFrequency set to 100 - this crash does not appear to happen on Android.
I get this exception with every event. But in GAv3 prefab dispatch period set 5.
Also I tried set dispatch period in script, but it didn't help:
try
{
googleAnalytics.dispatchPeriod = 20;
googleAnalytics.DispatchHits();
}
catch (Exception ex)
{
Debug.Log("DispatchPeriod" + googleAnalytics.dispatchPeriod + " EXCEPTION: " + ex.Message);
}
Plugin perfect work in Android, but crash iOS Simulator
Unity Version: 4.6.3f1
Backend Scripting: IL2CPP
Devices Tested: iPad Mini 3, iPhone 6, iPhone 6+, iPhone 5s, iPhone 4s, iPhone 4
Problem: No analytics data will send/(be received?) for 64-bit devices even though app will build and run as expected. No noticeable errors are encountered. 32-bit devices send analytics as expected. Doing a build using backend scripting of Mono 2.x will send/receive analytics data as expected.
Importance: App Store requires 64-bit build versions of new apps and IL2CPP is the only way to make this happen. Old apps have until June to comply.
I'm having trouble sending exceptions. Everything else works fine.
Below is some more info
10-09 18:15:16.328: I/Unity(10464): AndroidJavaException: java.lang.NoSuchMethodError: no static method with name='createException' signature='(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;' in class Lcom/google/analytics/tracking/android/MapBuilder;
10-09 18:15:16.328: I/Unity(10464): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0
10-09 18:15:16.328: I/Unity(10464): at UnityEngine.AndroidJNISafe.GetStaticMethodID (IntPtr clazz, System.String name, System.String sig) [0x00000] in :0
10-09 18:15:16.328: I/Unity(10464): at UnityEngine._AndroidJNIHelper.GetMethodID (IntPtr jclass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0
10-09 18:15:16.328: I/Unity(10464): at UnityEngine.AndroidJNIHelper.GetMethodID (IntPtr javaClass, System.String methodName, System.String signature, Boolean isStatic) [0x00000] in :0
10-09 18:15:16.328: I/Unity(10464): at UnityEngine._AndroidJNIHelper.GetMethodID[AndroidJavaObject](IntPtr jclass, System.String methodName, System.Object[] args, Boolean isStatic) [0x00000] in :0
10-09 18:15:16.328: I/Unity(10464): at UnityEngine.AndroidJNIHelper.GetMethodID[AndroidJa
This is more of a post for to note that in my version of Xcode (5.0.2), the frameworks and dynamic libraries are located at different directories. So if you want to add them automatically using the PostprocessBuildPlayer_GA file, open it using any editor, and make changes to the code to reflect the following.
frameworks = [
'AdSupport.framework',
'CoreData.framework',
'SystemConfiguration.framework'
]
for framework in frameworks:
pbx_object.add_file('System/Library/Frameworks/' + framework, tree='SDKROOT')
pbx_object.add_file('usr/lib/libz.dylib', tree='SDKROOT')
pbx_object.add_file('usr/lib/libsqlite3.dylib', tree='SDKROOT')
Hope this helps someone.
This is more of a question than an issue per-say:
I know that the google analytics mobile sdk is for Android / IOS - but is there any way to use google analytics for a normal 'desktop' application? We have a game on Steam (for example) that I'd like to use GA to track usage etc. Is this a supported use case?
Thanx in advance
I tryed to attributing iOS link like this
https://www.youtube.com/watch?v=K5gNZP6IqEk
https://developers.google.com/analytics/devguides/collection/ios/v3/campaigns-update#url-builder
But it's don't work. I can't see install's source in analytics. In case of Google Play attributing works well
Is Advertising support for remarketing in the pipeline for the plugin?
Per https://support.google.com/analytics/answer/2444872?hl=en for the Unity plugin? Or is there some workaround?
I understand it's been requested before, however there is considerable rising demand for Cardboard Unity built apps since this was raised and last answered in the autumn of 2014.
thanks
Reference: http://docs.unity3d.com/ScriptReference/TooltipAttribute.html
By hiding UnityEngine.TooltipAttribute you break inspector fields of serializable classes that used to use UnityEngine.TooltipAttribute and any other inspector fields that used to use UnityEngine.TooltipAttribute together with another attribute like UnityEngine.RangeAttribute as they automatically switch to your implementation, which doesn't support those two scenarios.
Either add a prefix to your own implementation or use UnityEngine.TooltipAttribute in your code as well.
Hi! After a couple of minutes of using the Game in Unity, the Editor shows that the console is being filled (999+) with Null references in the GoogleAnalyticsMPV3 class in just a couple of seconds. Particularly, this line:
GoogleAnalyticsV3.getInstance().StartCoroutine(this.HandleWWW(new WWW(newUrl)));
Some debugging made me realize the instance was null, therefore the error. I solved it replacing the code with:
try {
GoogleAnalyticsV3.getInstance().StartCoroutine(this.HandleWWW(new WWW(newUrl)));
} catch (Exception e){
}
To avoid filling the log and replace the getInstance code with this:
if (instance == null)
instance = this;
return instance;
Before, if would just return the instance and since it was null, I was getting the error. Will this affect my reports in any way?
i tested your plugin works great for iOS and Android but when testing it on Windows Phone, no data is uploaded. is this expected? anyway to work around the issue?
In a Unity 4.6.4 Web Player build, we're getting various warning messages depending on browser that state things like:
"Google Analytics hit request rejected withstatus code HTTP/2.0 200 OK"
"Google Analytics hit request rejected withstatus code 200 OK"
I'm assuming these are actually accepted, but the the "STATUS" header value is not exactly matching "HTTP/1.1 200 OK" so it is warning about it.
When trying to send a tracking event from the editor or web player, I get the following WWW error:
Google Analytics hit request failed with error Rejected because no crossdomain.xml policy file was found
Shouldn't Google be serving a crossdomain.xml file in their web root per the Unity security model:
http://docs.unity3d.com/Manual/SecuritySandbox.html
Not a problem on iOS.
Hello,
When i turn on wifi connection, the data will send to googleanalytics realtime, but when i turn off, i can see messages in logcat that message sent but nothing in googleanalytics realtime.
If I copy/past URL in googechrome on device, the data will be send to googleanalytics realtime.
Who can help me ?
Thanks.
Aymeric
GoogleAnalyticsMPV3.cs : Line 126-128
WWW request = new WWW(newUrl);
while (!request.isDone) {
}
This while loop causes a lockup when run in the web player, per Unity documentation:
http://docs.unity3d.com/ScriptReference/WWW-isDone.html
This should be changed to make the WWW request inside a StartCoroutine and yield until finished:
WWW request = new WWW(newUrl);
yield return request;
First, thank you for this great plugin!
The problem is after exporting the project for Android in Unity, I see an extra permission in manifest.xml.
Without plugin, it doesn't appear. Is it an expected result? Many users do not want to download the application when they see read_phone_state permission.
Hi
I am integrating google analytics in my unity 3d app.This app includes AR Camera.And i am building my app in XCode new version 6.1.1.
This plugin works fine,i can track the same screen on my google analytics account.but my ARCamera is not opened when i integrate this plugin in my app.
and the camera works fine without this plugin.
Please help me
Thanks
JKThakur
I'm used to the Flurry plugin and perhaps I've not understood the documentation right, but why is there a need to link the GA prefab with each object to be tracked ?
i.e. in a whole game comprising multiple Scenes and game objects, wouldn't it be simpler to have a static class to intiailize GA, and for each event / object to track, we'd just call a GAManager.trackEvent('name'), etc?
Hi team,
Thanks for GA for unity3d,
Could you please change GoogleAnalyticsV3 as a Singleton?
It's so boring to drag a the GV3 to all object tracked, and so when tracking object instansiated in runtime.
Thanks before,
The iOS plugin crashes upon logging an event when a dictionary contains null values, e.g. a custom dimension or metric.
I didn't find anything about demographics in readme. Am I have to enable this feature in Xcode and Eclipse separately, or is there any way to enable it in Unity.
Hi,
When our character dies we want to log that as an event, we are using this inside the Player Killed method:
if (googleAnalytics != null ) {
googleAnalytics.LogEvent(new EventHitBuilder()
.SetEventCategory("Death")
.SetEventAction(Level.currentLevel));
}
This is on the Start() Method
if (GameObject.Find("GAv3") != null) {
googleAnalytics = GameObject.Find("GAv3").GetComponent();
}
The log is working fine, it shows on the Analytics website, but the sound mutes for like 0.1 seconds and the game lags. Any ideas of what could be causing this?
Thanks.
Hello,
I'm using your plugin for my apps but I have a recurrent problem with my Android Device. When I'm connected with 3G everything works well, but if I connect it to my WIFI net the tracking data aren't sent. In Addition, if I execute the app from Unity Editor (connected to the same WIFI), this works.
I've read all the documentation and the configuration is well. But I can't solve this issue.
Thanks.
Hello,
I'm using Unity 5.0.0.0f4
I got this warning:
Assets/Plugins/GoogleAnalyticsV3/GoogleAnalyticsV3.cs(121,29): warning CS0618:
UnityEngine.Application.RegisterLogCallback(UnityEngine.Application.LogCallback)' is obsolete:
Application.RegisterLogCallback is deprecated. Use Application.logMessageReceived instead.'
Due to the fact that I have to add an AndroidManifest.xml to my plugins folder with new permissions, if I change settings like Bundle Version Code in Unity Player Settings I have to change that too in the androidManifest file inside the plugins folder?
In order to support Demographics and Interests inside my iOS application I extended the current Google Analytics Plugin for Unity to support the Google Analytics Services SDK for iOS v3.10 as follows:
id<GAITracker> trackerWithName(char *name, char *trackingId) {
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithName: [NSString stringWithUTF8String:name]
trackingId: [NSString stringWithUTF8String:trackingId]];
tracker.allowIDFACollection = YES;
return tracker;
}
id<GAITracker> trackerWithTrackingId(char *trackingId) {
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:[NSString stringWithUTF8String:trackingId ]];
tracker.allowIDFACollection = YES;
return tracker;
}
void setName(char *name) {
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName
value:[NSString stringWithUTF8String:name ]];
}
Will allowIDFACollection
be supported inside the next plugin release?
I'm trying to get how long the users spends in a level. Initally I tried the LogTiming, but I got some weird large numbers (run when progressing to next level);
googleAnalytics.LogTiming("Scene",45000,"Timing", Application.loadedLevelName);
Now I'm looking into LogScreen, which has Avg. Time On Screen, but this doesn't reflect the correct time either (run when on level start);
googleAnalytics.LogScreen (Application.loadedLevelName);
After compiling in unity using the PostprocessBuildPlayer scripts, the added frameworks are red (can't locate framework) in Xcode. The script is adding references to:
System/Library/[framework].framework
Whereas with OSX 10.10.2 and XCode 6.1.1 at least, this path should be:
System/Library/Frameworks/[framework].framework
and libz.dylib and libsqlite3.dylib appear to have moved to:
usr/lib/[library].dylib
I'm trying to install and setup the plugin for running on an iOS device on my existing project. Following the guideline, I have created a GameObject and and added the script with a public GoogleAnalyticsV3 using GAv3.prefab. Android Tracking Code, IOSTracking Code, Product Name, Bundle Identifier, Bundle Version have already set with
Dispatch Period: 5
Sample Frequency: 100
Debug Mode: VERBOSE
Anonymize IP: false
Dry Run: false
Session Timeout: 1800
Then when running on iOS device, I got an EXC_BAD_ACCESS in
File: GAIHandler.m
Method: void send(const char* parameters)
Line: 244
Statement: NSString *attris = [NSString stringWithUTF8String:parameters];
Not calling any function even DispatchHits() or StartSession() gave me the same result. I have also tried to log the tracker and got (null).
What I have missed? Please suggest me to figure out this issue. Thank you.
Is this feature supported?
Meaning if the intent is correctly defined in the manifest will it send the campaign data automatically?
If not is there a way of getting the data that were set at the installation and set them manually?
Thanks for any advice.
Hello, i just wanted to know if Google Analytics v4 is supported? Regards
https://developers.google.com/analytics/devguides/collection/android/v4/
currently plugin does not have any method to enable advertising feature for demographic data (and much more). Would you please provide one?
Hi,
I am facing problem in Mac build of unity.
I am using the code snippet below:
I am using the basic LogScreen() method but when i see my account after run the mac build, what i m see is,
In Real Time Category , one desktop is online but when i go for further details like "Session By Operating System", then it will show (not set) along with number of sessions.
I checked all session after two days also but i am getting the same issue. I am not able to figure out this problem for last two days. Please share your thoughts, what i am doing wrong.
I want to hearing from you. I hope you will help me.
Thanks in advance.
Thanks & Regards,
Rajan Walia (Unity Developer).
Hi, I have a game which runs on both iOS and Android. The codes are exactly the same, however, by observing the real time report, it looks like the hits appear per 5 seconds on an iPhone 5s whereas 3-5 minutes on a Galaxy Note 2/ Sony Xeperia Tablet . The dispatch period is set to 5 in the prefab for both of them. The battery are all fully charged. Any idea about this issue?
In the editor it successfully sends the version through to google analytics. I am using version "1.2.345".
Here in the editor:
Base URL for hits: http://www.google-analytics.com/collect?v=1&ul=en&sr=352x768&an=DressUp+Test&tid=XX-XXXXXXXX-XX&aid=com.makielab.DressUpTest&cid=XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX&av=1.2.345
In iOS the version it seems to be completely missing (no &av):
GoogleAnalytics 3.06 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:424): Saved hit: {
parameters = {
"&_u" = ".t2oeooonoKo-KL";
"&_v" = "mi3.0.6";
"&aid" = "com.makielab.DressUpTest";
"&an" = DressUpTest;
"&cd" = "ModeStartup/INIT";
"&cid" = "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX";
"&did" = GbOCSs;
"&sr" = 768x1024;
"&t" = appview;
"&tid" = "XX-XXXXXXXX-XX";
"&ul" = en;
"&v" = 1;
"&z" = 12106554111422438929;
gaiVersion = "3.06";
};
timestamp = "2014-09-18 09:36:28 +0000";
}
The google analytics plugin appears to conflict with the google play games plugin.
With both plugins installed in a project, these two jar files:
both contain the class file com/google/android/gms/analytics/internal/Command
.
When attempting to build for Android, the following error is produced:
CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:\Program Files\Java\jdk1.7.0_75\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/path/to/android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/analytics/internal/Command;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at SDKMain.main(SDKMain.java:129)
1 error; aborting
]
The google-play-services.jar is just the official package sourced directly from the android SDK, while libGoogleAnalyticsServices.jar comes pre-compiled in this git repos, so I figure that this is a problem to be dealt with by this project, rather than by play games services.
Is there a way or it's still a feature for tracking and keep the campaign Id for each App/Game installation?
Hi,
hooked up everything from the Docs (manifest, properties, verbose logging, no dry run, singletons don't get destoryed, etc..), but I can't see any hit from the Unity Editor (play mode).
I put the full measurement protocol URL that is to be sent, even the coroutine returns with success, but no hit registered real time.
When I simply copy the URL into my browser, real time hit immediately show, like it always did using iOS / Web SDK.
Is there any minor detail I missed?
Hi there!
I have no clue about how the PostprocessBuildPlayer works, let alone linkers, but after following the steps on how to setup this Google Analytics plugin, my iOS project won't compile with the following errors:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSOverwriteMergePolicy", referenced from:
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
However, if I add the currect libraries manually, the project compiles.
What steps should I follow so that the libraries do get added upon running the project from Unity? Anything I can do to debug why they don't get added by the postprocessing script?
I'm using Unity 4.6.0f1 and Xcode 6.1.
I have followed the instructions given in readme,but when i build the app.
It is giving me an error in xcode,"Could not initialize the tracker" and "Failed to set hint 'HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS' because the ImageTracker has not been initialized" and "CameraDevice::getCameraCalibration(): Failed to get camera calibration because the camera is not initialized"
pls help me
I have integrated analytic sdk as described however i am not able to see real time users,
I'm in unity 4.3 and TooltipDrawer causes stack overflow exception by code in line 30:
EditorGUI.PropertyField(position, prop, content);
this line causes infinite loop.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.