Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Google Universal Analytics for Unity - Support Thread

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

  1. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @MozzieByte,

    Excuse for asking, but can you check the internet connection is other ways checked to be fully functional on the Nexus 7? Do you get blank page or error if you access http://www.google-analytics.com/collect or https://ssl.google-analytics.com/collect on the browser of the Nexus?

    I just extra-verified that the included example works on an up-to-date Nexus 7, both with WiFi and carrier data, and with various settings.

    Can you try that example as well if it works for you? Slightly modified:
    - make an empty project
    - import the Google Universal Analytics asset
    - put your own stuff in the Android Player Settings (bundle id, version etc.)
    - open Analytics/Examples/AnalyticsExample scene
    - create a new test tracking property in GA site, name it e.g. "analyticstest"
    - select the Analytics component in the scene, modify your new test tracking property ID to the tracking ID field there and change the app name to "analyticstest". (keep "use offline cache" enabled)
    - in build settings, add both AnalyticsExample and AnalyticsExampleSecondaryScene to the "Scenes In Build"
    - build&run to install on your nexus (shouldn't matter if it's dev build or not)

    After you get it running and if it doesn't work, I'm interested what you see in the example main screen, number after "Remaining entries in the offline cache:" and if the bottom of screen shows "Verified internet access:" to be True or False & what is the Unity NetworkReachability status.

    Note also that when offline cache is enabled and if GUA asset ends up in an error when trying to connect to analytics server, it will pause for some seconds until it tries again to connect to the analytics. If there's no error and it's just waiting for connection then it will check again in 5 seconds, but if the internet is supposedly available but there's connection error, then it waits 20 seconds before trying again (with the default time period settings).
     
  2. MozzieByteGames

    MozzieByteGames

    Joined:
    Feb 16, 2012
    Posts:
    9
    Hi @tonic,

    Both of the links show a blank page on the Nexus and I can browse any site without issue.

    I created a blank project as you suggested and it all works well!!! :)

    Clearly, I'm doing something amazingly brilliant (NOT) that is causing the issue. As soon as I work out what it is I'll post the answer up regardless of how embarrassing it will be.

    I really appreciate all your time and effort in assisting me these past few days...thank you!

    Update: Resolved!
    @tonic I promised that I would share the cause of the problem no matter how embarrassing so without further delay:
    What I had done in my project is to create a separate scene to effectively handle the starting/initialising of the Analytics along with some other features for storing data in the 'cloud'. It all worked great in the editor but, unless I remember to add the scene to the build settings it'll never work on a device.
    So folks, when you move the Analytics to a scene of its own don't forget to add the scene to the build settings.

    @tonic, my apologies for troubling you with this.
    To everyone else, not a bad word can be said about the length of support provided by @tonic and his commitment to helping those that need help (some more than others like me).
     
    Last edited: Sep 1, 2014
  3. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @MozzieByte, great to hear you got it working & thanks for the kind words. I'm sure somebody else will find the same troubleshooting suggestions useful what I wrote for you. :)
     
  4. Kolyunya

    Kolyunya

    Joined:
    Nov 28, 2013
    Posts:
    2
    Hello, @tonic ! Does your library provide a functionality to find out where did the player come from to the market when he installed my application? E. g. is it possible to know the installation referer?
     
  5. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @Kolyunya,

    Sorry, but for now there's no ready-made support for any platform specific things which require native code.

    That being said, it would be of course possible to make some own code to listen for that kind of information (whatever is the mechanism on a particular platform -- e.g. the use of install referrer on Android). After getting that info, then you can of course write small bit of code to send that info to analytics using this package. Note that some people seem to have problems with the referrer info with later android/sdk versions - I haven't personally tried to use it though.

    If you're adventurous and try to implement listening for that info yourself, and then want to try sending the info using my asset, here's bit of extra info which might be helpful:
    Apparently the install referrer info has the following fields, and I think they should be mapped to my asset's API like this: utm_content->addCampaignContent, utm_medium->addCampaignMedium, utm_campaign->addCampaignName, utm_source->addCampaignSource, utm_term->addCampaignKeyword, utm_id->addCampaignID, gclid->addGoogleAdWordsID, dclid->addGoogleDisplayAdsID. (There may be other fields as well, e.g. gmob_t, but there do not seem to be info available if those are needed at all or how they should be mapped to the measurement protocol.)

    PS. I think your question was solely about Android, but you might be interested to know that latest version 1.5.0 added similar small feature for Web player builds where you can use addDocumentReferrer with null url, in which case the web page's own document referrer will be used - which is the traffic source in that case.
     
  6. robertwahler

    robertwahler

    Joined:
    Mar 6, 2013
    Posts:
    43
    Looks like an interesting asset. I have multiple apps that share a common resource. Can I set the Tracking ID from code before the first analytics hit is sent? Thanks.
     
  7. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    @robertwahler, I'm not sure I understood what kind of situation you have, but you I'm pretty sure what you want can be achieved with some minor modifications to the Analytics.cs component.

    Currently that source file defines this field: "public string trackingID;" where the tracking ID goes, and can be set in the Inspector. In Awake() that field is passed to the helper class which Analytics class refers with field named "gua", initializing like this:
    gua.initialize(this, trackingID, clientID, appName, appVersion, useHTTPS, offlineCacheFilePath);
    So just make sure you're using the tracking ID you want at that point in the code, i.e. substituting with another one if you need to. If you want to defer the analytics initialization, perhaps you want to rename the Awake() method there to public void startAnalytics() or something, and call that from some other script once you're ready to go.

    Hope this helps!
     
  8. robertwahler

    robertwahler

    Joined:
    Mar 6, 2013
    Posts:
    43
    Thanks for the quick response! It sounds like renaming Awake will allow me to set the tracking ID and then manually start tracking. That will work for me.
     
  9. muiscatron

    muiscatron

    Joined:
    Mar 24, 2014
    Posts:
    2
    Hi @tonic. I am using version 1.5.0 of your plugin and it is a great product - it helped me get analytics working really quickly. I have a requirement to activate demographics reporting for my app. I can't find any google documentation describing how to activate this using the measurement protocol. Do you have any suggestions?

    thanks
     
  10. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @muiscatron. This is something I've been asked before, and I have looked into it a bit -- and noticed the same what you did, that there isn't any clear info available about it.

    The short answer is that unfortunately I do not have a solution for you. My "Google Universal Analytics for Unity" asset is built to be a relatively light-weight cross-platform solution to use the measurement protocol. My understanding is that the way Google does the demographics tracking, one needs to have a deeper platform integration (with the native code libs etc) - and indeed it is apparently relatively easy to enable the estimated demographics tracking if one uses the native android/ios google analytics library. The exact details for this stuff are not documented.

    I'm not sure about this ... but my wild guess for now is that it might work if one would supply "correct" display ads id to the analytics (can be added to an event using Analytics.gua.addGoogleDisplayAdsID). The correct id in this case might mean integrating google play services library and using the advertising id you can get using it. -- (On the other hand it may be that the advertising id actually doesn't even have anything to do with the demographics tracking, or it may also be that the correct measurement protocol parameter name isn't that one but an undocumented one.)
     
  11. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Version 1.5.1 is now available!

    New in 1.5.1:
    • Small tweak to sendPageViewHit and its documentation.
    • Upgrades for latest additions to measurement protocol: added addDOMInteractiveTime and addContentLoadTime.
    • Verified Unity 4.6 compatibility, and made small changes to add preliminary compatibility with Unity 5 beta.
     
  12. Peacewise

    Peacewise

    Joined:
    Feb 27, 2014
    Posts:
    52
    Thanks for such a great extension!

    My questions is about hit limits. Google says for iOS:
    "iOS SDK
    Each property starts with 60 hits that are replenished at a rate of 1 hit every 2 seconds. Applies to All hits except for ecommerce (item or transaction)."

    I want to make sure I'm reading this right. The property is my iOS app, at the global analytics level. This means the hits are counted across all users. And at a replenish rate of 1 hit per 2 seconds, that's 1800 hits per hour. If I have, say, 1800 concurrent users of my app, then they can each only send ONE hit in an entire hour. This seems incredibly low. So... please tell me I'm interpreting this wrong? (Whereas for Android, it says it's per tracker instance on a device, which seems totally reasonable.)
     
  13. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @Peacewise, nice to hear you like the GUA asset.

    The limit you quote from the Limits and Quotas page is part of the "client library / sdk specific rate limits" chapter, which talks of individual tracker instances. So I'm pretty sure you can think of that rate limit for a particular user or application instance, not to be scaled for all users.

    However, note that this asset does not use the mentioned client libraries, but is implemented instead using the measurement protocol. The limits which apply in that case are quoted a bit upper in that web page: max 200,000 hits per user per day (it's unlikely you hit this), and max 500 hits per session (you might hit this if you're careless - editor build will log warnings in that case). And, additionally, there's the property specific limit of 10 million hits per month per property for the free GA account.

    So, for example: If you have e.g. 3000 users having 1 session per day, and one session sends 100 hits, you'll be sending 9 million (30*3000*100) hits per day, which should fit well inside the limits.
     
  14. Peacewise

    Peacewise

    Joined:
    Feb 27, 2014
    Posts:
    52
    Thanks for such a detailed reply, and so quickly! This definitely is good news.
     
  15. muiscatron

    muiscatron

    Joined:
    Mar 24, 2014
    Posts:
    2
    Thanks for your detailed reply.
     
  16. joihelgi

    joihelgi

    Joined:
    Jan 21, 2014
    Posts:
    19
    Hi @tonic , do you know how I can record high-score, so I can se the average high score of all users in google analytics

    The problem is that if I send a hit with high-score, and the user gets another high-score, it will calculate both high-scores and that will not give me accurate data about the high-score

    e.g. if user 1 gets high-score of 10, and user 2 gets high-score of 20, then user 1 gets a new high-score of 20, google will get 3 hits with total score of 50 and average 25 but the real average of user 1 and 2 is 20
     
  17. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @joihelgi, I understand what you're trying to do. But I guess that it's not possible to do that with GA.

    But that sounds like a feature which wouldn't be too hard to implement with some own custom code running on an own server - possibly by making a simple database table with a single row per user id, and each user id having the best highscore so far. It should be fairly simple to fetch average score from such a table.
     
  18. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    @tonic I apologize if I didn't search well enough, but I couldn't find online documentation on how to use your asset or some API reference. I was considering different ways to do cross-platform analytics and your asset is a possibility, but I wanted to see how the asset is used beforehand. :) Could you help me?
     
  19. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @CanisLupus, that's right - I should add a few usage examples to the website!

    Meanwhile I sent you a private message with a zip with documentation and example code from the package.
     
    CanisLupus likes this.
  20. paulos

    paulos

    Joined:
    Mar 11, 2015
    Posts:
    3
    Hi @tonic have a question re windows compatibility.
    Is only Unity Web Plug ins supported/possible IE if the client runs from an .exe file from Steam will the GA tracking in place still work?
     
  21. Stew_Dog

    Stew_Dog

    Joined:
    Mar 11, 2015
    Posts:
    1
    Hi Tonic,

    I purchased your code, but sadly it says "error" when I try to download. Why is this? Can you email me the code manually? I can provide receipt.

    Thanks,

    Allan
     
  22. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @paulos: Yes it works for stand-alone (exe) applications as well!
     
  23. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    @Stew_Dog, I have no idea why that might happen. Perhaps it's a temporary glitch in the asset store system?

    If it doesn't work by trying again after a little while, please email to contact (at) strobotnik.com with your OR123456789-like receipt code, and I'll set up a separate download link for you.
     
  24. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    I had the same problem with another asset, would not download at all. Waited a day, and then it suddenly worked.
     
  25. paulos

    paulos

    Joined:
    Mar 11, 2015
    Posts:
    3
    Thank you for your reply - is there any more documentation on how the tracking side works in terms of .exe > web browser syncing. I would like to track users post game to website and am not sure how the tracking in the application works vs web player plugins.
     
  26. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    @paulos, I'm not sure I understand what you're asking about. Do you mean about users posting a link to your game to websites?

    This analytics asset is meant to help sending data collected by yourself in the game to the Google Analytics service. You can use same analytics property ID for building to both stand-alone exe, for web player plugin or for mobile devices. The device type (operating system) of users can be seen in the data when you browse the Google Analytics pages for your tracking property.
     
  27. paulos

    paulos

    Joined:
    Mar 11, 2015
    Posts:
    3
    Sorry - I mean that with the tracking code (UA-XXXXXXX-X) that is generated in the analytics script is it possible to track (or google to track) this code on websites etc. IE see if players of game have also visited my website etc?
     
  28. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Ok now I see. By default websites and apps are tracked separately. The GUA asset generates a random id for the user so by default there's no connection to any user id what is used by google web analytics when browsing the site.

    But there is still options to overcome this...

    For very lightweight "referrer tracking" you could have a button in your game which launches a browser, and just before that sends an event to the app analytics tracking profile that user went to website. And if user clicks to a page with a web player build of the game, then you could send a custom built event with addDocumentReferrer and url set to null (a special feature just for web player plugin - this will set the document referrer of the event to be the web page document.referrer info).

    However, I guess you're likely more interested in deeper integration between actual website and a game/app. This requires manual setup of same user or client id in different ways of tracking, and some careful testing between the options of using same tracking property for everything or having two separate tracking properties, etc.

    I haven't implemented the minute details of such integration. But for the general idea here is my answer to similar previous question by @yevdokia, who reported getting it working in that case:
    http://forum.unity3d.com/threads/google-universal-analytics.202335/page-2#post-1704025
     
  29. IronNinjaGames

    IronNinjaGames

    Joined:
    Jun 14, 2014
    Posts:
    14
    Hi Tonic -- I've been using your plug in for a while and have enjoyed it overall.

    However, there are now two errors constantly popping up since I upgraded to 4.6.3:
    'UnityEngine.Application' does not contain a definition for 'logMessageReceived' (CS0117) -- this appears on lines 275 and 332 in Analytics/Scripts/Analytics.cs

    I at first thought it might be a corruption on my end, so I uninstalled and reinstalled Unity, but the errors are still occurring in the fresh build.

    Do you know what the problem might be?
     
  30. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hello @IronNinjaGames. Nice to hear you like the asset.

    I couldn't reproduce the issue on 4.6.3f1 ... that issue looks like compiler is fooled not to think that the Unity version is 4.6 - that line of code is meant for Unity 5.0+, and the previous line of code is an #if directive which rules out UNITY_4_6 among other versions.

    For time being, you could work around this issue by commenting out around both reported lines the nearby #if, #else and #endif lines, and the lines containing the Application.logMessageReceived ... This should leave you with the alternative code line which looks like Application.RegisterLogCallback(....); (do not comment that one, it is meant to be used with Unity 4.x).
     
  31. IronNinjaGames

    IronNinjaGames

    Joined:
    Jun 14, 2014
    Posts:
    14
    Thanks, Tonic

    I did in fact install Unity 5 to work with for a short while, then uninstalled and plugged back in Unity 4.6 for our upcoming launch. My guess is the switch back must have created the issue somehow...
     
  32. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    @IronNinjaGames - have you tried to delete the whole Analytics folder, and download again & import again the analytics package to your project?

    (Perhaps the automatic script updater in Unity 5 did something so that the code doesn't work with 4.x anymore...?)
     
  33. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    Does it have inbuilt campaign tracking for android and ios?
     
  34. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Sorry, no, campaign tracking isn't built-in.

    That needs native code implementation tweaks and focus of this package is more geared to features available with wider platform coverage rather than just using iOS or Android. If you're content to implementing analytics only on those platforms, then you might want to just use google's own integration library.
     
  35. Ernesto505

    Ernesto505

    Joined:
    Jul 4, 2013
    Posts:
    2
    Hi Tonic,

    We recently purchased your plugin to use it for a visualisation project that was used in an exhibition. The problem is that the machines that the software was installed were not connected to the Internet. We were under the false impression that when we will connect the machines all the cached data will be uploaded to Google Analytics.

    Going through the documentation again though I found this paragraph:

    Measurement Protocol specification warns that if requests are too old, then hits may not be processed. This limitation is set in the Google Analytics service and you cannot change it. The official age limit in the specification is 4 hours. However, in google-analytics-measurement- protocol group, it has been stated that “docs should actually read 4 hours past midnight of the configured timezone in the profile”.

    From what I understand this means that all the data that our machines have cached will be rejected from Google Analytics as soon as we connect them to the Internet because they are old.

    If this is a case is there a way to circumvent this restriction by Google or even just save the data and extract them in some other way? I read in the documentation that everything is stored in the GUA-offline-queue.dat. Will this file contain all the cached information?

    I know that your plugin implementation (which works really well by the way and is very easy to integrate) is not to blame for this problem and I would really appreciate any help you could provide on this issue.

    Thank you in advance!
     
  36. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @Ernesto505, sorry to hear you've ended up in a bit difficult situation like that! Here is ideas about how you could proceed and hopefully enough details as well.

    Before proceeding with any tries, I suggest you make backup copy of each machine's GUA-offline-queue.dat file. It's a text file in fairly simple format, so it will be possible to extract information from that. The location of that file of course depends on the OS, but you can find it from the Application.persistentDataPath folder supplied by Unity. On Windows it can be e.g. C:\Users\USERNAME\AppData\LocalLow\COMPANYNAME\APPNAME\GUA-offline-queue.dat

    Additionally for each file you need to store two key&value pairs from app's PlayerPrefs, with keys which start with "GoogleUniversalAnalytics_offlineQueueLength" and "GoogleUniversalAnalytics_offlineQueueSentHits". (It's most likely that the sent hits value will be 0, and queue length value will be amount rows in the offline queue text file.) I'm not sure if it works the same way on all platforms, but at least on Windows the PlayerPrefs are in the windows registry under HKCU\Software\COMPANYNAME\APPNAME and the actual key name has some additional postfix, actual key being something like: "GoogleUniversalAnalytics_offlineQueueSentHits_h144223634".

    Each row in the GUA-offline-queue.dat file contain three tab-separated tokens. 1st token = "version", always 0. 2nd token = timestamp of the analytics hit in milliseconds, starting from epoch datetime of 1970-01-01. 3rd token = somewhat final data to be sent to the Google Analytics url - when GUA asset sends this data from the cache, it only adds the queue time and "cache buster".

    So, if you want to just do some manual stuff with the data, you can of course parse the third token of each row and do whatever custom things you decide to build with it.

    Or, you can of course try to feed that data to Google Analytics as well. I don't know if there is any way to do that without losing the original occurrence time for each hit event though. It is possible to feed this data to the GA either by making some own custom scripts which send those third tokens there using http or https (see httpCollectUrl or httpsCollectUrl for destination in GoogleUniversalAnalytics.cs). Alternatively you can make a modified version of the GUA asset and make a rebuild of your software. The modification should omit adding queue time and possibly do additional session control.

    To omit the queue time, look for this comment: "// verify w/queue time if we can consider the hit to be valid anymore at all" in the GoogleUniversalAnalytics file. Either force queueTime to 0, or just comment out the following code which does anything with the queueTime (until the row increasePlayerPrefOfflineQueueSentHits(); which you should not comment). After this the hits should be considered "just happened" when sent from the offline queue. However, this may not be enough - now that all hits are sent very near to each other. So unless you already had used forced addSessionControl(...) calls, GA will consider the large bunch of hits to be same session, and you'll hit the limit of allowed hits per session - again leading to discarded hits.

    Very simple fix for that would be to perhaps just force new session every 500 sent hits: if (offlineQueueSentHits%500==0) addSessionControl(true);
    But instead of that, a much better fix for that would probably be to make some custom code yourself to compare the queueTime of the particular offline cached hit to the previous one. If there's large enough difference measured in milliseconds (e.g. 10 minutes = 10*60*1000=600000), then call addSessionControl(true); before sending that hit from the cache. (You still may want to count how many hits you're getting per session and do force additional reset if you hit 500).

    When you send data to GA remember it takes time to be batch processed and actually show up there, apart from initially showing up in the realtime view.

    In case things don't seem to work out and you decide you need to try again, you can then put back the backup copies of the GUA-offline-queue.dat file... but for that to be used and read you need to also set the correct values to the PlayerPrefs I mentioned at beginning of this post (maybe its easiest to learn where the PlayerPrefs are on your platform and set them manually correct before starting app again for a retry). Also note that in case you want to switch GA tracking profile where the cached offline hits are associated, you can search-replace all instances of the "tid=UA-XXXXXXX-Y" string in the offline cache file.
     
  37. Ernesto505

    Ernesto505

    Joined:
    Jul 4, 2013
    Posts:
    2
    Hi Tonic,

    Thank you very much for your prompt and very detailed response!!

    I am waiting confirmation at the moment from the people at the exhibition that they have retrieved the .dat files from the machine. All these solutions you describe seem like they will solve our problem so I guess we will experiment and see what is the best course of action. I have checked that .dat file structure and as you say it is pretty straightforward so I believe it will be easy to find a solution as soon as we have the files.

    Once again thank you very much for your reply although as I said above this is Google Analytics issue and not your responsibility. By the way out of curiosity if we had the machines connected before backing up the .dat files would we have lost all our data?
     
  38. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    @Ernesto505, if you have the machines connected to internet and at the same time run the Unity app which uses the GUA asset, then it will start sending the cached hits in the background (with some throttling). Once all of them have been sent, the .dat file will be deleted. When some of the hits have not been sent yet, the file will still contain all cached hits (and the GoogleUniversalAnalytics_offlineQueueSentHits playerpref tells how many of them have been sent already).
     
  39. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Version 1.6.0 is now available!

    What's new:
    • Added support for Unity 5 WebGL platform.
    • Clarified docs to reflect latest changes in measurement protocol specs.
    • Added debug data validation warnings to send*Hit convenience methods.
    • Added sendExceptionsAlsoFromEditor checkbox to make sending of exceptions optional when running in editor.
    • Minor compile fix for Windows Store builds.
    • Added new methods setDataSource and setGeographicalOverride.
     
  40. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Version 1.6.1 is now available!

    What's new:
    • Show visual warning when using example GA tracking property ID in own projects.
    • Minor tweaks to WSA/WP compilation.
    • Use newer/alternative automatic user language determination code on all platforms, mainly to fix iOS/IL2CPP 64-bit issues.
    • Fixed asset store Unity 5 warning.
     
  41. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @Jet Woods Lim,

    First please verify you have upgraded to latest version (1.6.1).

    Unfortunately I could not replicate the issue you're describing with Unity 5.1.1f1.

    However, note that you don't need and you are not supposed to use two separate Analytics objects in the scenes. The first one uses DontDestroyOnLoad, so it persists over when you load a new scene. The analytics object in the second scene will detect that there is already an analytics object, and will not start another. (See beginning of the Awake() method in Analytics.cs)

    If you can't find a fix, please give more details: What is the displayed error exactly?

    Preferably, create a mini test project which shows this problem, put it into a package and send download link or attachment by email: contact (at) strobotnik.com
     
  42. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
  43. OneeChan

    OneeChan

    Joined:
    Feb 19, 2013
    Posts:
    2
    Hi @tonic

    I recently purchased this plugin for a project and this is also my first time working with GA. The code integration and development went fine thanks to your plugin and now the project is launched and data start coming in. But the data I have so far seems a bit strange to me. I've try looking around the web for similar concern but I haven't found anything satisfying, but like I said this is my first experience with GA so I may have missed important things. Hope you can shed some light.

    First thing that looks weird is that when I look at the demographics of each city, a large portions of them have multiple sessions, but without any screen hit. My understanding was that to get a session hit, user need to interact with the app, which should at least have a screen hit for the main menu.

    Also, another thing that bothers me is that I have 380 new users, but only have 52 hit for each actions inside the SystemInfo_since_v001 event.

    It looks like most users are registered with basic demographic information and session hit, but their in-game interaction like game event and screen views are not registered, even the SystemInfo_since_v001 event.

    Let me know what you think about that if you have the time. Any insight is appreciated!

    Thanks!
     
  44. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @OneeChan, how fresh is the data you're looking at? If it's only up to a day or so, give GA some time and check back. Apart from what one can see in the real-time view, the data is batch processed. So it's better to wait and look at the data after a day or two.

    And yes, logically you should be seeing screen hits, especially if you're seeing them from some users using the same build... (i.e. it does not seem to be a mistake in integration of the asset)

    Indeed what you describe seems a bit puzzling.

    What platform(s) are you using? If you're running on web (web player plugin or webgl), try to see if enabling using of HTTPS works in the Analytics component settings. On web, apparently any special browser plugins/extensions in user browsers may interfere with analytics (ad blockers, greasemonkey, etc). But enabling analytics to be sent over https should reduce that problem.
     
  45. OneeChan

    OneeChan

    Joined:
    Feb 19, 2013
    Posts:
    2
    @tonic thanks for the tip, I'll try enabling https on the web version. I'm currently using web (Unity plugin), Android and iOS and the app as been running for a week, with some data getting in everyday.

    I've just tested with all the platforms and noticed that the iOS version does not show up in the real-time section (also noticed that I don't have any Apple device registered in the device section yet). I've tried with 2 different ios devices and got the same result, so maybe that where the problem is. Would there be a setting to double check or enable for the plugin to work properly on iOS? I also have another script of my own that sends http post to a database to keep track of the high scores and this works fine on iOS, so there shouldn't be any problem on that side.

    Thanks for the help so far!
     
  46. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    First, please verify you're using the latest version of Unity itself (either latest 4.x or 5.x), and also of GUA plugin (1.6.1). Unity itself had somewhat recently a new issue with implementation of the WWW class on iOS, which was possible to fix by adjusting ObjC code (fix was available in the forums somewhere, but was also later included in newer Unity version as well). Also GUA plugin got some relatively minor fixes which also affected iOS (64-bit il2cpp builds more exactly).

    Have you verified with iOS devices yourself that the analytics hits show up in the real-time view? If not, it's time to debug it, e.g. by looking at the Xcode console...
     
  47. jgagne

    jgagne

    Joined:
    Dec 2, 2014
    Posts:
    3
    Hi @tonic, this is @OneeChan but with my other account

    Updating both Unity and the GUA Plugin seem to have solved the problem. iOS devices are now showing in the realtime section and I can see them in the OS section of SystemInfo_since_v001. I'll see in the next few weeks if the data make more sense now. For more details about the issue. I was using GUA plugin version 1.5.1 with Unity 4.6.5 and was deploying to iOS using IL2CPP and universal architecture.

    Thanks for the support!
     
  48. ayalasan

    ayalasan

    Joined:
    Dec 10, 2012
    Posts:
    16
    Hi tonic,

    I am looking at some options before I choose which plugin I should get. I need to be able to determine the Referrer when a user installs my app after being invited through a viral link.

    I am looking for a plugin which handles Android's Referral attribution. With this plugin is there any callback to get the REFERRER string id from Unity.

    Is BroadcastReceiver extended and this callback available inside Unity?

    Which sdk version of GA are you currently using v3? v4?

    Thanks in advance!
     
  49. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    439
    Hi @ayalasan, this plugin doesn't have "native code" integrations at all -- so it is not using the official GA libraries under the hood. Instead, data is sent to GA using measurement protocol. This way the same code works well across many platforms (rather than just some mobile ones).

    Because of this, install referrer tracking is not supported. It would be possible to implement this yourself and then send that data using this asset (possibly after some modifications). But I think you will be easier off by using some other Unity integration library instead, which uses the official GA android library. (Google itself is supplying one for Unity nowadays as well, although it's still in Beta. I think it may be viable solution for iOS or Android, although I'm not sure if it implements the referrer tracking either.)
     
  50. ayalasan

    ayalasan

    Joined:
    Dec 10, 2012
    Posts:
    16
    Thanks for the transparency @tonic. I am indeed taking look at google's option as well, but still haven't managed a way to track the referral id. Good to know that this plugin works well across multiple platforms, but seems to be a little deviation on what I'm needing nowadays.

    Cheers!