This asset does not have support for Google Analytics 4. Please understand that this asset will stop working on July 1, 2023.
Sales of this asset are discontinued. The asset is now “deprecated”. It is only available for download in Unity Asset Store for those who have purchased it earlier.
Big thank you to all of you who have used this asset, and thank you for the feedback! “GUA” was the solution for roughly 10 years to combine Unity and Google’s “Universal Analytics”. It was the first such asset, and outlived all similar assets that existed for a short while.
This package brings Google’s Universal Analytics to Unity, with widest platform and Unity version coverage using the same asset. This is the only Google Analytics integration library with all of the features listed below.
• Ready-made Analytics component for drag’n’drop integration.
• Automatic sending of errors and exceptions to analytics.
• Automatic client System Info statistics (sent on first launch).
• Automatic events when new level/scene is loaded.
• Automatic caching of analytics hits when user is offline and throttled sending of cached hits in the background.
• Automatic reachability check which determines if client is offline or the analytics server is reachable. (Generalized version of this feature alone is also available as a separate product: Internet Reachability Verifier).
• Use the same code to implement analytics for Desktop, Mobile and Web builds!
• Browser: Unity WebGL
• Desktop: Windows
• Desktop: Mac OS X
• Desktop: Linux
• Desktop: Windows Store
• Mobile: iOS
• Mobile: Android
• (Not tested on console platforms, but if UnityEngine.WWW or UnityWebRequest classes work, then this should as well.)
• (Also supported legacy Unity Web Player plugin, BlackBerry 10 mobile and Windows Phone mobile, when those were still used.)
• Note: No support for certain platform-specific features, such as demographics reporting or automatic tracking of traffic sources (iOS / Android specific).
• Example scenes to show functionality and how to implement user opt-out possibility.
• Comes with guide to set up your tracking property to a Google Analytics account, integration instructions and helpful hints how to interpret analytics results and make a custom report.
• Complete API for the Measurement Protocol of Google Analytics.
• Support for new set of Enhanced E-Commerce analytics (first integration library to add that!).
• HTTP and HTTPS support.
• Toggleable debug warnings, e.g. if you’re going over session hit limit (enabled by default when running inside editor).
• Doxygen documentation for the code.
• Designed with goal of having minimal amount of memory allocations.
• Custom-built user agent strings on the platforms where that’s required to improve detection by Google Analytics.
• Full source code included. Implemented in Unity with C#.
• No need for big platform-specific library files.
• No need to tweak project files for each platform.
• Superior memory usage characteristics compared to some other integrations.
• Maintained for all Unity versions from the most recent one down to Unity 5.6.7 (version 1.8.4 was the last one to support Unity 3.5.7-5.6.6).
Note: The analytics service itself is run by Google, and offered for free.
Short answer is that “it should”. Hits to analytics are sent using the UnityEngine.WWW class, which is supported for Windows Store targets. But, we haven’t personally tested it yet. (Would you like to spend a bit of time to help and test&verify Windows Store support? I’m sending you a private message!)
EDIT:
Psychor wrote back and told that running on Windows Store worked well after a minor fix (comment out single row referring to UnityEngine.Handheld class which isn’t available when building for that platform). Thanks!
Custom Dimensions Metrics as well as Exceptions are part of the Google’s spec for measurement protocol, which this package has an API for. So they should work just as well as the other features.
However, there’s some points to keep in mind:
About Custom Dimensions Metrics – You need to set them up in the Admin section of your Analytics account, and associate an index to them. For normal Google analytics account there’s 20 indices to use, and for premium accounts they give you 200.
More information in these pages: Custom Dimensions Metrics - Feature Reference and Set up custom dimensions metrics
About Exceptions – There’s an Exception HitType, and possibility for optional description and “is exception fatal” boolean, which can be sent as a hit for the analytics. However, this package is not a product for intercepting crashes, so it’s up to you to solve how to have a normal/stable state and have some real data to be sent to analytics. One way would be to write some code to read UnityEngine.CrashReport.reports on next application start and submit those as analytics (there isn’t a ready-made example how to do that though; I might add that in the future).
I spent all day today trying to figure out how to get Google Analytics to work with the Unity Webplayer and although I understand a lot more about the measurement protocol I was not able to hack my way into a solution so…
I just want to make sure that your solution works with the Unity Webplayer Builds and sends to www.google-analytics.com directly without having to use an intermediate script on the website that hosts the Webplayer version of the game???
It’s important to me because I’m trying to limit the amount of concurrent connections to my hosting site.
Thank you for what hopes to be an awesome solution!
today I bought your Asset. Well Done. My Games are also spread on arcade sites, not using the GA code. So, I can use mobile as the property for Analytics. Is there a way to use GUA with all the features of websites, without the need of GA code on site? That is the way, free web games are spread. Any ideas?
The GUA web code works so that it injects javascript to the web page for sending analytics hits. It doesn’t need modifications to the web page.
So, as long as a particular web site doesn’t do something weird in their site templates to make it incompatible with the technique, it should be possible to use this in such freely distributed web games as well. I don’t have practical experience about this though.
thank you for the answer. Yes. it works also without GA Code on the site, but the Google property for that site must be in mobile mode then. Or did I miss something? Were you able to track data in such a way? No GA Code on site, property on web mode?
I think it currently doesn’t matter if you have created the property initially to track a Website or Mobile app, but instead it matters which kind of View you use (or create) to the property to check the data. You should use a “Mobile app” view for the analytics using this package.
The way this stuff is set up in the Google Analytics site has been changed recently. Please make sure you have the latest version of this package (now 1.2.0), which also has an updated setup instructions pdf.
I have a problem with iOS tracking. All data that comes in from that platform shows as (not set) and the devices do not show with their device names as Android devices do. What am I doing wrong?
Google Analytics should pick up the platform automatically from the User Agent string which is always part of the http requests sent, and use that to show as platform in the standard reports. But, that just doesn’t seem to happen all the time, or at least not for all users, and unfortunately there’s no way to force the platform/OS manually for the requests. Some other users have also reported this same issue, which is something Google needs to fix.
I suggest you try (and verify) some or all of the following steps:
Make sure you have upgraded to latest version (currently 1.2.0) of this package. This isn’t going to fix anything by itself, but ensures you have the latest instructions how to set up.
Verify your Property in the Google Analytics site is enabled for Universal analytics (i.e. you property shouldn’t show “Universal Analytics Upgrade” / “Transfer not started” button).
Try to make a new View for your Property in the analytics web site, and select “Mobile app” for that view. Then make some new hits (and wait for at least 24 hours), and see if you see the hits properly when using that new view.
If that doesn’t work, you could also try if creating a totally new Property helps. Follow the updated instructions in Instructions_GoogleUniversalAnalyticsForUnity.pdf.
While this is not exactly the same thing than having the platform correct in the default reports, but you can try to create a custom report and use the data which is part of SystemInfo events sent by Analytics.cs on first launch. To see how to do an “OS from Events” custom report, read the chapter “Example of Creating a Custom Report” in the Instructions_GoogleUniversalAnalyticsForUnity.pdf.