Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Integration Issues Troubleshooting

Discussion in 'Unity Analytics' started by sschan, Oct 13, 2015.

  1. sschan

    sschan

    Unity Technologies

    Joined:
    Oct 8, 2014
    Posts:
    87
    Having issues with your Analytics integration? Please review these suggestions to troubleshoot.

    5.2 Integrations

    error CS0103: The name 'Analytics' does not exists in the current context
    This error typically occurs when you are working offline or have Analytics disabled. You can use the UNITY_ANALYTICS compilation define to surround your Analytics calls which will only cause Analytics to be compiled with your project when Analytics is Enabled and it will also remove these errors from the console in the editor.




    Not seeing your Custom Events in the Validator
    If you are not seeing your Custom Event recorded in the Validator be sure that they are not contained within any of the application startup or shutdown functions. For example, Awake(), Start(), OnApplicationQuit(), etc

    You can also test whether Analytics is currently running in your game by writing the event call directly to the Console.

    Debug.Log (Analytics.CustomEvent ("TestEvent", new Dictionary<string, object>{ {"firstObject", 10 } }));

    If ‘OK’ is returned then Analytics is running and your event was successfully sent. If ‘NotInitialized’ is returned then Analytics is not running and your event was not sent.


    SDK Integrations

    Development Build (applicable for SDK 1.9.1 and higher)
    Analytics events are always sent to the Validator from the Editor with no additional configuration needed. To send events to the Validator from a device build (iOS / Android / etc), ensure your build enables the "Development Build" option (File > Build Settings ... > Platform > Build Settings).
     
    Last edited by a moderator: Mar 16, 2016
    nicholasr likes this.
  2. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    I'm having an issue with this and unity ads.

    as of 5.2 we no longer need to download an SDK? can you confirm this?
    "The name Analytics does not exist in the current context"
    and yes I have "using UnityEngine.Analytics"
     
  3. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    328
    Yes. In 5.2 Analytics is built right into Unity. There's no SDK (so if you're using the SDK from before, please remove it). You do need to turn on Analytics in the Services Window, which is a little "Cloud" button in the upper right of of Unity.
     
  4. scott-plutovr

    scott-plutovr

    Joined:
    Aug 27, 2015
    Posts:
    3
    I see one event in our dashboard after enabling Analytics for our Unity project but nothing from anyone else running the app in the Editor or from our builds (currently just PC) since. Do we need to enable that "Development Build" checkbox under the Platform Build Settings?
     
  5. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    328
    No need to enable "Development Build". I can see a fair number of events in your validator (no custom events, if that's what you're looking for). Can you be more specific about what you're not seeing that you think you should be seeing?
     
  6. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    182
    Hello,

    I get this error when i tried to build for Android (still didint test for iOS yet) "Assets/Plugins/UnityAnalytics/AndroidWrapper.cs(9,41): error CS0246: The type or namespace name `BasePlatformWrapper' could not be found. Are you missing a using directive or an assembly reference?"

    How to fix it please ?

    Thanks
     
    Last edited: Dec 27, 2015
  7. mpinol

    mpinol

    Unity Technologies

    Joined:
    Jul 29, 2015
    Posts:
    315
    Hi @SIV,

    Which version of Unity are you using? Are you using the downloadable Analytics plugin or engine integrated Analytics found in the Services window?
     
  8. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    182
    Hello,

    Im using Unity 5.3.1, i downloadede the plugin then later used the integrated service, im i doing it wrong ? after i download it i didint find any configuration, so i thought i need to use the one in services.
     
  9. mpinol

    mpinol

    Unity Technologies

    Joined:
    Jul 29, 2015
    Posts:
    315
    @SIV,

    The downloadable plugin will only work with the editor up to version 5.1. For 5.2 and onwards you must enable Analytics through the Services window. There is also one more thing to take note of, for the engine integrated Analytics, 5.2 - 5.3, a call is Analytics.CustomEvent() but for the downloadable plugin it is UnityAnalytics.CustomEvent().

    Can you please try removing the downloaded plugin, turning Analytics on in the Services window, creating/linking your project to an Analytics project, double check that your code is formatted correctly, and then let me know what the result is?
     
    SIV likes this.
  10. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    182
    Yes it works now thank you :D
     
    mpinol likes this.
  11. geliosoft

    geliosoft

    Joined:
    Jan 7, 2016
    Posts:
    27
    I am using Unity 5.3.1 and Analytics has been enabled through the Services window. I am trying to add custom event to my code on Javascript for Android, but get the next error:

    'CustomEvent' is not a member of 'UnityEngine.Analytics'

    Example code below:

    #pragma strict
    import System.Collections.Generic;
    //import UnityEngine.Analytics;

    static function SetGameOverStats(levelNo: int, time: int)
    {
    var d: Dictionary.<String,Object> = new Dictionary.<String,Object>();

    d.Add("LevelNo", levelNo);
    d.Add("Time", time);

    Analytics.CustomEvent("GameOver", d); // ERROR HERE
    }
     
  12. mpinol

    mpinol

    Unity Technologies

    Joined:
    Jul 29, 2015
    Posts:
    315
  13. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    414
    One question: will the availability check be changed in the future?
    I like the easy integration of the anaylitcs plugin, but user management and availability checks are horrible. Currently we set every people in the team of our organization to "owners", just to avoid the next compilation problem with the plugin. Other plugins handle availability checks in the plugin itself and hide it from the user. I would prefer that also for UA, though I guess that component and code stripping are one of the reasons why it is not done yet.
     
  14. mpinol

    mpinol

    Unity Technologies

    Joined:
    Jul 29, 2015
    Posts:
    315
    Hi @pahe,

    Can you please elaborate a little bit on what you mean by availability check? Also, what compilation problems you were running into?
     
  15. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    414
    Sure.

    We've got some trouble when new people are checking out the project. When the project tries to compile, it often fails as it can't compile the UA libraries as it is turned off. Even adding the people to our organization as members is not sufficient sometimes, as they don't have the "permission" to turn it on again, which is "strange" as it is already active for all other people.
    Only solution is to logout with the current account, login with another account who is admin, enable the UA option, log out and login with the new user.

    So, by availability check I mean, the check if UA is enabled or not is somehow flawed/buggy and is not received correctly from the Unity cloud (I guess there is somewhere the information stored).

    From other plugins, I know that they still compile, even if the plugin is not supported on a specific platform and this is something I would also like to see with UA.
     
  16. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    311
    Hi @pahe,

    I believe that all users should be able to turn Analytics on and off. Can you fill out a support ticket and send me a screenshot of your organization overview (found in My Organizations -> manage/the cog image -> Members) and the emails of a couple of the users not able to toggle analytics on and off? Also which version of the editor you are using.

    Until we are able to figure out what is going on with the accounts, our current recommendation for availability checks is to surround your analytics code with if defined statements, as described in first post on this page, so that it is only included when Analytics is on. This should allow the project to compile, even when Analytics is off.
     
  17. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    414
    @erika_d
    Ok, I'll try to reproduce it again and create a ticket for you. Due to this, I already modified our code with the define statemens (found this thread when I was searching for a solution :) ).
     
    erika_d likes this.
  18. chilberto

    chilberto

    Joined:
    Nov 18, 2013
    Posts:
    19
    @sschan Is the following still true?
    While we are in Beta we have set a limit to the number of parameters a single Custom Event can have to 10. If you are sending more parameters in a Custom Event this is most likely the cause of your events not being received by the Validator.
    I am having trouble finding documentation that mentions a Validator and/or how to trouble shoot when things are not working. Can you provide a link that goes into more detail? I am searching through the forums but this is not ideal.

    What I am experiencing: I have custom events defined with the names: PlayerDied, PlayerQuit, PlayerResart, EndLevel 0 Thread 1. I believe these are being sent correctly as I can see some of them in the Support/Integration/Custom Events page but these do not appear in the Data Explorer.

    I do see the unity.sceneLoad custom event but I did not create this. Is there any documentation around what this is and what it means. I can guess but the parameters all have the same value and do not have any real meaning to my game.
     
  19. mpinol

    mpinol

    Unity Technologies

    Joined:
    Jul 29, 2015
    Posts:
    315
    Hi @chilberto,

    If you are seeing events logged on the Integration pages then they should also populate on the Data Explorer page after approximately 6 hours. If it has been over 6-8 hours would you mind opening a support ticket with your project id here, https://analytics.cloud.unity3d.com/support so that I can take a look into this?
     
  20. junglemason

    junglemason

    Joined:
    Dec 30, 2010
    Posts:
    69
    "be sure that they are not contained within any of the application startup or shutdown functions. For example, Awake(), Start(), OnApplicationQuit(), etc"

    Am I reading this wrong? Can we really not put analytics code in Start or Awake methods? I would like custom events when the app starts (not reliant on any user input). Is that possible, and how? Thanks!
     
    Last edited: May 10, 2016
  21. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    311
    Hi @junglemason,

    Currently it is correct that Analytics events shouldn't be put in Awake, Start or Quit methods. Awake and Start are because we can't guarantee that Analytics would have started up before those events were supposed to be fired. The issue with the Quit method is that Analytics is shut down during quit, therefore preventing it from sending any events.

    Although we don't have any confirmed workarounds for sending events in Quit, this thread has users discussing some workarounds they have attempted: http://forum.unity3d.com/threads/cant-send-in-ondestroy-or-onapplicationquit.296657/

    For the start up events, you can try starting a coroutine in one of these methods, which sends the event after a time delay. This delay would have to be long enough to ensure Analytics has started up, and unfortunately I cannot make any guarantees that this would work, but at least it's something to try!
     
    unityjingyao likes this.
  22. antx

    antx

    Joined:
    Feb 16, 2012
    Posts:
    28
    I just started on the subject of analysis and was wondering if Unity Analytics provides any way (like an API) for the user to read out the collected data automatically (instead of manually via the dashboard), so that the data can be processed according to the users needs.
    I would need this particulary for the CustomEvents (not for Error/Crash reporting).
     
  23. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    erika_d likes this.
  24. Amuzo

    Amuzo

    Joined:
    Mar 18, 2014
    Posts:
    1
    Hi - I am new to Unity Analytics, and am having issues committing any services settings.
    We have a separate build machine which builds from a repository, but this does not store the analytics services settings.
    Is this possible? am I missing a settings file which contains this information?
     
  25. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    Hi @Amuzo

    The two files in a project that are modified when you enable Services are:

    /ProjectSettings/ProjectSettings.asset
    /ProjectSettings/UnityConnectSettings.asset

    I would check to make sure those files are being updated properly when you commit.
     
  26. Ripityom

    Ripityom

    Joined:
    Jan 9, 2016
    Posts:
    4
    Hi,

    I have trouble setting up custom events.
    I've set up a couple of custom events in my game, and I get Ok result after sending them, however on the advanced integration page the validation still writes 'wainting for test data'.
    On the first try I accidentally put a report in an update() fucntion, so I quickly reached the request limit, but now i get Ok result back for my reports.
     
  27. PharaohSolutions

    PharaohSolutions

    Joined:
    Dec 11, 2016
    Posts:
    1
    I also have the same issue.
    Trying to integrate analytics for Android build target as IL2CPP build using either Unity 5.5.0f3 or 5.5.0p1.
    When I attach debugger I'm receiving AnalyticsResult as OK for custom events but events are not showing up inside Analytics Dashboard.
    WindowsEditor events are shown inside Dashboard properly.
     
  28. evilzug

    evilzug

    Joined:
    Mar 30, 2014
    Posts:
    2
    I am getting an "OK" response back from the Analytics call, but the 'validate' section on the integration page is still spinning, as well as the in-editor validator is not showing any recent events.

    Not sure what the issue is! Does Windows 10 have a firewall?
     
  29. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    @Ripityom, @evilzug

    We have heard some reports of the Validator not showing events correctly, even though we do receive them. We've been able to reproduce the issue on Firefox, but not Chrome, so changing browsers may be an option to see your events in the Validator. We are still investigating that bug.

    Alternatively, you can now view the Validator in the Editor. Under the Services window, if you choose Unity Analytics and then select the Validator:

    **Note: This window must be open for events to show up here.**

    editor-validator.PNG
     
    evilzug likes this.
  30. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    @PharaohSolutions

    I believe you sent a support ticket about your issue and this was resolved. If you are still having any issue receiving events from Android devices, please let me know.
     
  31. evilzug

    evilzug

    Joined:
    Mar 30, 2014
    Posts:
    2
    I just checked my dashboard and the data has been tabulated/recorded. For whatever reason, the events weren't showing up 'live' either on the website or within the Validator window in the Editor. Not sure what the deal is, not a perfect scenario, but as long as they are showing up, then that's probably ok.
     
  32. Dani-10

    Dani-10

    Joined:
    Jan 4, 2017
    Posts:
    3
    Hi!

    I have some problems integrating Unity IAP with Unity Analytics... I think I've followed all the steps, because I receive the test purchase events from the editor and also introduced my Google API Key on the Unity dashboard (since I'm just testing on Android now) but the Revenue on the Unity dashboard remains at $0.

    The problem is that I'm sure I'm receiving the "unity.PurchaseFailed" event every time there's a purchase, with the reason "UserCancelled". However, all the purchases are being processed correctly on the Google dashboard.

    chart.png
    I should mention that I'm not calling Analytics.Transaction() since I'm processing the IAP with the Unity api IStoreController.InitiatePurchase() and IStoreListener.ProcessPurchase() and I've read that Analytics are triggered automatically using this IAP api. As I receive purchase events I think this is well configured...

    am I doing something wrong? Maybe I'm missing something?

    Thanks in advance!
     
    Last edited: Jan 4, 2017
    MSUnityPro3 likes this.
  33. Frima

    Frima

    Joined:
    Jan 26, 2016
    Posts:
    51
    Hi,

    I integrated some analytics 4 days ago. I can see them in the unity analytics validator tab. I can also see them almost instantaneously in the integration tab of the dashboard.

    My issue is that even with this setup, the "Event Manager" tab is still empty. I tried to disable/enable "Dev build" in my build settings and waiting many hours but it doesn't seem to have any effect. What am I missing?

    Thank you!
     
  34. rayw24

    rayw24

    Unity Technologies

    Joined:
    May 23, 2016
    Posts:
    52
    Hey guys, sorry for responding so late!

    @Frima Are you able to see the Custom Events in Event Manager now? If not, could you send me a private message with your project ID so that I can help you look into this?

    @Dani-10 that's actually due to a bug that we've been experiencing which was just resolved yesterday. Could you please check again and see if the revenue is correct now?

    Thanks! :)
     
    Last edited: Mar 21, 2017
  35. harleywinks

    harleywinks

    Joined:
    Nov 14, 2014
    Posts:
    7
    Having a problem where analytics stopped showing in validator (not showing in either editor or web).

    The events had been showing instantly in the UnityEditor validator, but then yesterday they stopped and I haven't been able to get them back.

    I can confirm that my Analytics.CustomEvent are happening and that the return values are always AnalyticsResult.Ok.

    It's hard to tell otherwise from the dashboard what's going on since my project is in dev and in early stages of analytics integration.

    I haven't been searching things like 'unity analytics validator troubleshoot' and I haven't found anything useful. The only recommendation I've found is that sometimes validator stops working due to network issues and to try restarting unity; so I've tried that now numerous times over the last day and a half, and no dice.

    I'm at the point where I'm going to have to strip down to a new project and see I can get it to do nothing but send an event and have it show in validator.

    Is there any other/better way to troubleshoot the events-not-showing-in-validator issue?

    Thanks,
    Larry
     
  36. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    Last edited: Jul 27, 2017
  37. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    109
    Has the validator stopped working again? I am getting nothing and have checked with the debug.log and got OK..
     
  38. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,079
    @Redrag Sorry for the delay, I just tested the Validator in the Editor here this morning, and it looks to be working. Can you confirm?
     
  39. omx-jonson

    omx-jonson

    Joined:
    Mar 23, 2014
    Posts:
    8
    Hey @JeffDUnity3D
    Trying to get validator up and running, OK is received, no events shows up :/
     
  40. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,079
    Please give it some time. If you want to open a support ticket, we can look further, but generally it takes a bit more time when the events don't show right away. You can go to the Support tab in the Analytics Dashboard to submit a ticket.
     
  41. LesBloom

    LesBloom

    Joined:
    Feb 2, 2017
    Posts:
    30
    I am unable to view any custom events in the Validator. I have tried to view the results in the Unity window, and I had the Unity window visible when the send occurred. I tried to view the results in the web dashboard. The result of the Analytics.CustomEvent call is OK. I have tried sending numerous types of events with no luck.

    Any help would be appreciated.

    Edit: It is working now. A reboot of the Unity Editor was the solution.

    Edit #2: I take it back. The sends only work for the first 'play' of the Editor session. I have to reboot the Unity Editor after each 'stop' of the 'play' session. This is true for MTX sends and setting User Attributes as well. I have reproed this 3 times now.
     
    Last edited: Nov 5, 2017
  42. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,079
  43. LesBloom

    LesBloom

    Joined:
    Feb 2, 2017
    Posts:
    30
    I am not sure if my previous edits were worded very well. So, just in case ...

    I was able to reproduce the following many times, 100% of the time, over the last weekend:

    1) Launch the Unity Editor.
    2) Go to the Analytics Validator section of the Services window within the Unity Editor.
    3) Hit play.
    4) Watch events populate.
    5) Hit stop.
    6) Hit play
    7) Notice no events populating
    8) Repeat 5-7 many times. Same thing. No more events.
    9) Close the Unity Editor
    10) Repeat 1-9 many times. Same thing. I only got events to populate for the first Play session of the Unity Editor.

    Thanks
     
  44. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,068
    @funnersoft,

    Which version of Unity did you have this issue with? I am unable to reproduce it with 2017.2.

    As Jeff mentioned, we've gotten several reports of issues with the Validator. We are working on some updates to hopefully make it a bit more reliable.
     
  45. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    I'm using 2017.2 as well and facing the same issue. Trying to get all the custom events registered, been three days. In a day i'm able to just call events in about 10-15 levels in one go and then it just gives up (and only shows App start, app running and app stop). And also, if I call the events rather quickly the validator gives up on me.

    Just checked the thread and saw that analytics calls should not be made in start, awake etc but that post is years old. Does this still apply? I am using one of my custom events in Awake.

    Thanks for the constant support.
     
  46. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,079
    @Deep_Ak Are the events showing in Data Explorer in the Analytics Dashboard?
     
  47. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    I thought it was just a validator bug and I triggered all the events in the game. Found out next day approx. 50 events were not shown in the Data Explorer.
     
  48. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,079
    Make sure you check the return code of Analytics.CustomEvent, which is of type AnalyticsResult. If you want open a support ticket and provide your ProjecdID/UPID, we could check our back end too. In the Analytics Dashboard, go to the Support tab to open a ticket.
     
    Deep_Ak likes this.
  49. Deep_Ak

    Deep_Ak

    Joined:
    Jun 24, 2015
    Posts:
    29
    I did open a ticket and I believe you just replied to me a couple of hours ago? This is the request ID : #439029.

    Thanks for looking into this, and I will check the AnalyticsResult as per your suggestion.