Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Released] Google Analytics SDK

Discussion in 'Assets and Asset Store' started by stanislav-osipov, Jun 9, 2014.

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    New documentation is ready to use :)
     
  2. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey guys, I am going on vacation so will be not available for the next week. If you have any question or technical issues feel free contact support team, they will work at full power)

    But I will able to solve more complicated stuff in a week!
    Cheers!
     
  3. Honikou

    Honikou

    Joined:
    Feb 18, 2013
    Posts:
    91
    Hi,

    I would like to implement this on the manifest :

    <service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
    <receiver android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver" android:exported="true">
    <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
    </receiver>

    From this : https://developers.google.com/analytics/solutions/testing-play-campaigns#prepare

    But that doesn't work with your plugin
     
  4. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Well, this feature is not supported by the plugin.
    If you want to implement an additional feature you can do this with no problems since plugin has fully open source code.

    For example, if you want to implement campaing measurment, as described in google documentation you also need to add some native code as well, adding few lines to manifest will not make it work.
    From documentation link you provided:
    Code (CSharp):
    1. // This example uses Google Analytics SDK for Android v3.x implementation
    2. package com.example.gatestapp;
    3.  
    4. import android.content.BroadcastReceiver;
    5. import android.content.Context;
    6. import android.content.Intent;
    7.  
    8. import com.google.analytics.tracking.android.CampaignTrackingReceiver;
    9.  
    10. /*
    11. *  A simple Broadcast Receiver to receive an INSTALL_REFERRER
    12. *  intent and pass it to other receivers, including
    13. *  the Google Analytics receiver.
    14. */
    15. public class CustomReceiver extends BroadcastReceiver {
    16.  
    17.   @Override
    18.   public void onReceive(Context context, Intent intent) {
    19.  
    20.     // Pass the intent to other receivers.
    21.  
    22.     // When you're done, pass the intent to the Google Analytics receiver.
    23.     new CampaignTrackingReceiver().onReceive(context, intent);
    24.   }
    25. }
    Cheers!
     
  5. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I haven't seen any posts about where this databis collected and can be viewed? How/where can I see the data thatbis sent from the apps in the field?
     
  6. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    What is the advantage of using this plugin over the standard Google Analytics Unity SDK package?
     
  7. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I bought the asset and got everything setup but I can't see any feedback on the Google Analytics dashboard concerning crashes/exceptions.

    I am intentionally generating divide by zero, and null pointer exceptions in the app. But seem they are not being tracked.

    NOTE: I can see page views sent by GoogleAnalytics.Client.SendScreenHit("Init Screen");)
     
  8. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I think I made a mistake in buying this asset. I don't want to track analytics of what screen was opened and how long the player stayed on that screen. I mainly want to track if my game crashes, and if so, where it crashes.

    But it seems that you have to expect where crashes might occur and use try/catch statements all in those places. But I have no idea in advance where the game could crash so I can't add these try/catch statements all over the place.

    Is using try/catch statements and in the catch part calling "GoogleAnalytics.Client.SendExceptionHit("ExceptionType", true);" the only way to do crash logging?
     
  9. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Sorry for slow reply. I just noticed your posts.

    Well GA not the best way to track the crashes, Besides, Google play console gives you crash reports by default. If you feel that assets is unuseful for you can always request the refund.

    Yep, this is API allow use to track exception.
     
  10. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Actually I like it. But I think maybe it is not what I was looking for as I am more interested in catching crashes than tracking where users have visited in my code.

    And I’m just wondering if I have to use try/catch with a GoogleAnalytics.Client.SendExceptionHit in order to track crashes. Say a crash happens at some place in my code that I did not expect, will that crash be reported.

    Also I don't use Google Play as my game will run on iOS and OSX.

    Also I noticed the next day I got a report from Google. So does it take a while for Google to get crash reports?
     
  11. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    All stat can appear with the delay in 24 hours, You can actually try this way for geting not fatal crashes without adding try / catch blocks:
    Code (CSharp):
    1. Application.RegisterLogCallback(HandleLog);
    2. void HandleLog (string logString , string stackTrace, LogType type) {
    3.  
    4.  
    5.         if(type == LogType.Exception) {
    6.             Client.CreateHit (GoogleAnalyticsHitType.EXCEPTION);
    7.             Client.SetExceptionDescription (logString);
    8.             Client.SetScreenName (Application.loadedLevelName);
    9.             Client.SetDocumentTitle (stackTrace);
    10.             Client.SetIsFatalException (false);
    11.             Client.Send ();
    12.         }
    13.  
    14.  
    15.         if(type == LogType.Error) {
    16.             Client.CreateHit (GoogleAnalyticsHitType.EXCEPTION);
    17.             Client.SetExceptionDescription (logString);
    18.             Client.SetScreenName (Application.loadedLevelName);
    19.             Client.SetDocumentTitle (stackTrace);
    20.             Client.SetIsFatalException (false);
    21.             Client.Send ();
    22.         }
    23.  
    24.     }
     
    ilmario likes this.
  12. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    @lacost, Thanks. So for non-fatal crashes all I need to do it add that code when my game initializes, then forget about it, and any crashes will show up in Google Analytics?

    How are you handling fatal crashes?
     
  13. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
  14. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    Thanks lacost. I got it set to Slow and Safe and I used your code segment.
     
  15. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    214
    Hi!
    I just bought your plugin, added account information and added GameObject to the main scene. Now i want to test is it working for my setup. When i run it in Unity editor, GA Runtime pane immediately displays 1 active user, that's a good sign. But, when i made Android build and started app on my phone (connected to Wifi internet), no runtime active users displayed. Since i got no log messages from GA plugin neither in the editor nor on device, i wonder how can i be sure setup is correct and it actually sending something? Maybe some additional steps required for Android builds?
     
  16. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello, plugin analytics sending changes a bit only for web player (due to security reasons). Just make sure your setting si correct and you have specified correct analytics account for the platform.

    P.S. I will do additional logins as well shortly. So you will see web request which was sanded
    Cheers!
     
  17. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Hi Stan,

    I have some problems with real-time analytics.
    I send screenHit and eventHit and I see them in overview.
    But nothing in real-time.
    What could be the reason ?!
     
  18. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Well, if you could see it in overview, it means all works fine.
    I mean there is no extra methods to send real-time or non-real-time analytics.
    By the way I didn't saw any issues with the real-time analytics on my project.

    But I would be happy to look into this if you cloud point me how to reproduce the described issue.
    Cheers!
     
  19. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    Hi Stan,

    yes it works fine now.
    Thanks.
     
  20. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Glad to hear that.
    Cheers!
     
  21. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    Does it have inbuilt campaign tracking for android and ios?
     
  22. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Not yet, but will be added in few weeks.
     
  23. ObOberon

    ObOberon

    Joined:
    Feb 22, 2014
    Posts:
    3
    Can I assign different "Tracking id" for each platform setting under the same account?

    For example. I have only one Google Analytics account, but I need 2 tracking id to track both iOS and Android for the same app. I found the inspector only allow to select "account name" under "Platform Setting" section.

    or I need to configure it at run-time only? Thank you.
     
  24. TBardoux

    TBardoux

    Joined:
    Jul 20, 2015
    Posts:
    6
    I would like to send the data to two different google analytics account (two different google analytics ID), is that possible ?
     
  25. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    Are Web GL builds supported with this plugin?
     
  26. tbll

    tbll

    Joined:
    Jan 19, 2013
    Posts:
    31
  27. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    You can actually add few different accounts, basically account = tracking id.

    Do you mean you want to send same data on same platform?

    Yep, all platforms is supported.

    Plugin is using

    The plugin is using Measurement Protocol which is unfortunately not yet supported this, As soon as any feature will appear in the Measurement Protocol I will add it.
     
  28. mog-mog-mog

    mog-mog-mog

    Joined:
    Feb 12, 2014
    Posts:
    266
    Any update on campaign tracking will be appreciated? Looking forward to native SDKs for automatic campaign tracking on Android and ios.

    Thanks
     
  29. TBardoux

    TBardoux

    Joined:
    Jul 20, 2015
    Posts:
    6
    Send same data to two different google analytics account
     
  30. Gamesupport

    Gamesupport

    Joined:
    Mar 24, 2015
    Posts:
    2
    Hey Stan,

    We are having an issue with the plugin when it comes to the webplayer. Current using version 2.8. When we send an event it clearly shows that it is sent out with the correct data but it will not populate our charts. The Tracking ID is surely correct, we have tested locally and putting the application on different hostings. Is there anything that could be missing?that AnalyticsInfo2.png
     
    VicM likes this.
  31. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I can add ability to choose hat account used to data send, you can send it twice with different accounts.

    About the issue with the web player, reports can appear in 48 hours, let me know if after 48 hours you will not see any data in the analytics dashboard.
    Cheers!
     
  32. oen

    oen

    Joined:
    Aug 6, 2014
    Posts:
    1
    Hi~
    I bought Google Analytics SDK.(Revision 2.8.2(Oct 29, 2015) )
    But it wasn’t Google Analytics SDK.
    it has IOSNative.
    What is this?
    Pls check it.
    (I sent ur email)
     
  33. sdalex

    sdalex

    Joined:
    Dec 17, 2014
    Posts:
    21
    Hi,

    I want to manage screen tracking manually since screens are not bind to levels in my project.
    Even if i uncheck the "levels" option it seem that when an event is send, or when they is an exception or error, the screen is changed to "Application.loadedLevelName" each time.

    Is there a reason why it is set in those places? To associate an event with a screen? Actually, i have to modify thoses functions to take the right screen name.

    Thanks!
     
  34. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Submission bug, sorry, it was already fixed.

    Hey @sdalex I am not sure I got your right, can you please contact me directly with the e0,ail with a bit more explanations on your issues. Thanks in advance.


    Cheers!
     
  35. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    @lacost, is the app version automatically tracked with your plugin?
     
  36. Playmac

    Playmac

    Joined:
    Dec 22, 2011
    Posts:
    76
  37. VicM

    VicM

    Joined:
    Mar 14, 2012
    Posts:
    22
    Hi there! Just acquired the plugin and set up everything in my app, tracking ids, event calls, however I do not see any activity registered in the Google Analytics dashboard, do you know if it takes time to see them or is it something wrong with my setup.

    Is there any debug mode to see if the call are being send, rejected?
     
  38. VicM

    VicM

    Joined:
    Mar 14, 2012
    Posts:
    22
    Some compile errors in Unity 4.7 that I was able to fix it due to the platform dependant compilation conditions not considering this version.

    Version 2.8.5 is not registering scenes automatically, screen hits seems to not be working and showing in the GA dashboard even I have used for several days.

    Does to the plugin send the app name and version? They are not showing up in the GA dashboard.
    Not sure if we need to set that info manually via a function call.

    UPDATE:

    After a lot of tme I finally was able to solve all of my problems.

    For iOS 9 it is very important to use HTTPS instead of HTTP.
    I was using HTTP
    (http://googleadsdeveloper.blogspot.mx/2015/08/handling-app-transport-security-in-ios-9.html).

    That is the main thing to allow the metrics to be send to the server, you can also allow insecure connections via the plist but not recommended (look here http://stackoverflow.com/questions/...-with-app-transport-security-enabled-in-ios-9)

    The other thing I did to solve the thing related to the app version, app name, and levels not registered in the analytics was to uncomment some lines of the plugin code that were not sending the app name and version in the headers and according to an stack overflow answer they are required or needed to register the metrics, not sure if true but worked for me. Reference here: http://stackoverflow.com/questions/26127293/measurement-protocol-not-working-for-mobile-app

    Hope that helps meanwhile we wait for an official answer or action.
     
    Last edited: Jan 10, 2016
  39. psypol

    psypol

    Joined:
    Dec 20, 2013
    Posts:
    25
    Hello

    i just bought the plugin and i'm able to see active/returningUser (that's just me ^^)
    in google analytics (in Reporting /Users Overview)

    BUT
    - when i launch the app i always see "At the moment 0 active users on app" in RealTime category

    Also i don't see anything else about the screens that user (me ^^) goes trough:
    => i added in Playmaker two moments in my game where i wanted to have metrics about :
    * When players start a new game
    * when players have a game over
    For this i added at some point of my FSM GA_ScreenHit with value "StartedPlaying"
    and when gameover occured i added another GA_ScreenHit in the FSM called "GameOver"
    PS : all my game flow takes place in a unique unity scene.

    Also im very unfamiliar with Analytics so i would be glad if someone could explain in a few words for what purpose
    its recommended to use each of the actions available for playmaker :

    ● GA_EventHit
    ● GA_ItemHit
    ● GA_PageHit
    ● GA_ScreenHit
    ● GA_SocialHit
    ● GA_TransactionHit
    ● GA_UserTimingHit

    the documentation mentions what is available but for Analytics total noobs it's difficult to figure out
    which action is the more suitable for which cases and also to which exact part of the analitics Dashboard the
    "result" of the implementation of each of those can be seen/tested.

    Thanks a lot for any help you could provide to me.
     
  40. Vtpl

    Vtpl

    Joined:
    Oct 14, 2015
    Posts:
    1
    hello .
    We try to Build demo scene of google analytics version 2.8.2 for ios .
    and when we run the project in ios9 device and we didnt get any impression event for active user. even work fine with unity editor but not work with ios device.

    i getting following Error from xcode 7.2 at startup:
    App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
     

    Attached Files:

  41. darkinyourass

    darkinyourass

    Joined:
    Sep 24, 2015
    Posts:
    28
    Sure, the latest version of plugin support automatically tracking.

    I think the best solution will be to write me an email - support@stansassets.com

    What about the latest version of the plugin from AssetStore. Have you still remained the problem?
     
  42. amoka

    amoka

    Joined:
    Dec 18, 2015
    Posts:
    58
  43. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
    it not really working the Sessions dont show in google only the Real-Time user works ??!!