Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Google Universal Analytics for Unity - Support Thread

Discussion in 'Assets and Asset Store' started by tonic, Sep 25, 2013.

  1. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    169
    @tonic -- thanks for the quick reply!

    Another question: does GUA allow me to explicitly queue up hits for sending later, e.g. queue them during the FPS-critical part of a level, then send them all at the end of the level?

    Related question: is there an FPS hit from sending a hit via GUA?
     
  2. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    @Ghopper21, GUA does not have such support for explicit queueing up hits until a bit later. It always tries to send the hit immediately.

    But the GA itself has limitation of 500 hits per session (more about limits in this web page). So, it becomes quite obvious that you need to think about what kind of analytics hits are actually relevant. So, sending lot of hits directly during gameplay (during "fps critical parts") is almost surely somehow "the wrong way", since you might end up filling that 500 hit limit quota too easily. More likely you want to increment some stats counters during gameplay, and then only at e.g. level ending send a hit or two with the collected data.

    I haven't got reports about GUA showing up as a problem with fps. Each hit is a simple WWW call. Building the hit uses a StringBuilder, reducing the amount of temporary strings for GC to collect later. But, as we can see from the above comments, you're supposed to be sending analytics hits only "rarely".
     
  3. Ghopper21

    Ghopper21

    Joined:
    Aug 24, 2012
    Posts:
    169
    Thanks for the good advice @tonic. Yes, I'm surprised to see a 500 hits per session limit for GA. I thought fewer hit limits was a big advantage for GA over Unity Analytics, but actually Unity's 100 events per minute limit seems high compared to GA's per-session limit (obviously depending on session length).

    In your view, what are the advantages of GA over Unity Analytics?
     
  4. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    @Ghopper21, I haven't done an in-depth look at Unity Analytics, so I cannot really give any insightful comments on that. If would expect UA to be bit more suitable for certain types of games with its more advanced features like heatmaps.
     
  5. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    1
    Hi @tonic This looks great! I would love to use it for our app. Does it work with Unity 2017.3 and PlayStation ?
     
  6. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    Hi @wwangbaobab, unfortunately I don't know for sure. I don't have access to a devkit and don't know about the restrictions on the platform.

    My guess is that if normal network connections are allowed, then it works (or perhaps if the GA is somehow whitelisted).

    I also guess that the hits might not show up with correctly identified platform. That would be both because of GUA asset not having bit of PS-specific user-agent code, but also because GA itself also probably doesn't detect PS as a platform. But, if you only send hits to a specific tracking profile (with nothing else sending hits there), maybe that's not a problem.
     
  7. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    23
    Looks like a great and simple package. However in the setup, Google Analytics has a new Firebase mandatory requirement, when setting up. In your directions it is this step:

    8. Select “Mobile app” and provide a Reporting View Name, for example “MobileAppData”. Click “Create view”.

    This option doesn't exist; now it forces me to use a Firebase project? I just REMOVED the Firebase plugin because it does not apparently support WebGL (Google does not disclose this up front and the WebGL build breaks without workarounds). My take is that Google is making a complicated mess out of what used to be a simple procedure.

    What do you recommend if I do not want to use a Firebase SDK in the Unity project. That's why I bought this plugin. Will it still work?
     

    Attached Files:

    Last edited: Apr 13, 2018
  8. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    @kwikdev,

    Hi, if you have purchased some time earlier and only now started to actually use this plugin, please make sure first that you have the latest version!

    The Tracking Profile setup instructions in the documentation have been revised a few months ago exactly because of the reason you're asking, since Google is forcing to use Firebase for exclusively "mobile" analytics (and there's no any support for that in this GUA asset!).

    In short, you now have to select that you are tracking a "Website", and be able to provide some kind of URL for it -- even if it is even somewhat of an dummy url (it can be company website, or a marketing website for the game, for example). After that it is possible to to create a "Mobile app" view in the tracking profile.

    The included PDF instructions contain a more detailed checklist.
     
  9. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    23
    The version is current, from yesterday. When you say, "create a Mobile app view in the tracking profile" that is where the instructions were unclear.

    If I don't somehow associate the ID with a Mobile app, will the base tracking still work? Just want basic Google Analytics and Events across WebGL, iOS and Android.
     
  10. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    Yes, unfortunately it is now a bit confusing that you have to first create a Website tracking property (since trying to create a "Mobile app" property will just force to firebase nowadays). And then only afterwards create separately a new view to your new tracking property, which is specified to be for viewing mobile app data.

    I think that the data sent to the profile will be saved, even if you haven't (yet) created a "Mobile app view". But, for actually seeing the data, I guess you still need to have a view.

    The checklist in the instructions pdf should work if you follow it closely step by step (well, apart from some tiny UI changes happening in the GA website, which seem to be happening somewhat often). Currently latest version of the doc states on first page: "This document has been revised in November 2017."

    Apparently the step 7 could be more clear. Now when you create a new property, GA opens automatically the tracking code page for that new property. So, when the PDF says "Return to Admin Home", it means you first click the little back-arrow (left of the list of options under property column). After that you get back to the three-column layout, where rightmost column allows you to Create a new view.
     
  11. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    23
    Thanks - tested it out today and works perfectly.

    Excellent and lightweight asset, only 2 classes, great job!
     
  12. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    Thank you! :D
     
  13. ZzappSizzler

    ZzappSizzler

    Joined:
    Jan 15, 2017
    Posts:
    33
    Hi Tonic. I've purchased and am implementing GUA. Right now I am setting it up for Custom Metrics. I've configured the Google Analytics Custom Definitions - Custom Metrics, to match my in game scripts. On the Google instructions page it tells me I now have to now have to modify my tracking code (see below). How do I do that? (Or have I already done it?)

    Here's a sample of my script:
    Strobotnik.GUA.Analytics.gua.addCustomMetric(1, gameController.extraHerosBought);
    Strobotnik.GUA.Analytics.gua.addCustomMetric(2, gameController.extraSleepysBought);
    etc....

    and here's the relevant part of the Google instructions:

    https://support.google.com/analytics/answer/2709829?hl=en
    ******************************
    Modify your tracking code

    After you create custom dimensions or metrics in your property, you must also modify your tracking code. This should be completed by a qualified developer. Follow the instructions in the Developer Guide for your specific environment:

     
    Last edited: Jun 1, 2018
  14. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    Hi @ZzappSizzler,

    The Google page is right that the custom dimension/metric usage tends to need some customized code.

    In case of this GUA asset, also this is covered in the API (addCustomDimension, addCustomMetric). But it's left up to you to do some custom code in the cases where you want to have the custom dimension/metric stuff. It's pretty easy as you can, for example, take the code of sendEventHit(...) as reference and do small additions.

    The earlier posting in this thread has one such example where additional addCustomMetric call has been added, please check out code of sendCustomMetricEvent(...) in this message:
    https://forum.unity.com/threads/goo...ity-support-thread.202335/page-5#post-2848981
     
  15. ZzappSizzler

    ZzappSizzler

    Joined:
    Jan 15, 2017
    Posts:
    33
    Tonic, I have a plugin clash. I was using EasyMobilePro for IAP. Now I have installed GA, and finally got around to building for Android again, I get a Unity message: 'Unable To Build DEX' and it looks like I have 2 versions of support-v4 in the plugins/Android folder- "com.android.suppoert.support-v4-26.1.0" and "support-v4-2.0". If I disable one or the other then the build will be successful but so far, purchasing for Android will not work. Which of the two versions are put there by GA, and, what will happen if it's deleted?

    Any help you can give would be great!

    Thanks
     
  16. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    @ZzappSizzler, sorry but I can not give you assistance. You should visit Google's own support forums instead, or EasyMobilePro support forums, perhaps send them a bug report and wait for answer.

    The "Google Universal Analytics" asset doesn't have anything to do with GA android plugins. Instead it has Unity-C# code which sends analytics hits using http(s), as defined in measurement protocol spec, so there are no native plugins and no plugin-related problems.
     
  17. TheGering

    TheGering

    Joined:
    Nov 26, 2012
    Posts:
    25
    Hi, I had a
    MissingReferenceException
    in your Plugin. I resolved it by making following changes:

    Code (CSharp):
    1.        
    2.  
    3. if (useOfflineCache)
    4.             StartCoroutine(netActivity());
    5. ...
    6.  
    7. if (useOfflineCache && !needReturnWWW)
    8.         {
    9.             StartCoroutine(doWWWRequestAndCheckResult(postDataString));
    10.             return null;
    11.         }
    12.         else // caller needs the returned WWW object:
    13.         {
    14.             return beginWWWRequest(postDataString);
    15.         }
    16.  
    17. ...
    18.  
    19.     public Coroutine StartCoroutine(IEnumerator routine)
    20.     {
    21.         return (helperBehaviour && helperBehaviour.gameObject) ? helperBehaviour.StartCoroutine(routine) : null;
    22.     }
    23.  
    I basically wrapped the call to start a Coroutine and check if the GameObject is still there. Most users shouldn't have a problem there, but I had. This fixes it just in case. Please add this change in you next update.

    Also I made another change:

    I changed
    Code (CSharp):
    1. sendUserTimingHit
    to take an
    long
    instead of an
    int
    for the time.
     
  18. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    350
    Hi @TheGering, thanks for the info. Good catch with the timing variable type. Can you tell me any details in what kind of situation did that exception happen - was it connected to loading new additional scenes, or switching to totally different level, or something?