Unity Google Analytics插件在Unity Editor中运行良好,但不会在Android上记录任何内容

时间:2015-10-29 09:28:26

标签: unity3d google-analytics

我已将google analytics插件添加到我的项目中。当我在Unity编辑器中运行它时,一切正常 - 我可以在Google Analytics网站上的桌面上看到1个人在" Real-time"标签。第二天,我可以看到"观众"中的所有数据。标签。当我将它推入我的Android设备时,它似乎根本无法工作。

我尝试过使用带有VERBOSE日志记录集的logcat,没有错误。这是一个示例项目运行:

D/Unity   (25299): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_
D/Unity   (25299): texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
I/Unity   (25299): Initializing Google Analytics 0.1.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Initializing Google Analytics Android Tracker.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging screen.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Enabling uncaught exception reporting.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging screen.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging screen.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging screen.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging event.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):
I/Unity   (25299): Logging event.
I/Unity   (25299):
I/Unity   (25299): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
I/Unity   (25299):

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:theme="@android:style/Theme.NoTitleBar" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="21" />
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

根据谷歌分析实时页面,没有人在玩游戏。认为它可能是不使用Android设备的实时标签 - 第二天,仍然没有来自Android的数据,只有桌面。任何想法可能是什么原因?

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,原来我在统一编辑器中跟踪代码后面只有一个空格。

我不会发现这个人是不是这样的人: Google Analytics Unity Not Sending Hits

  

我错过了一些东西,我的做法没有任何问题。

     

令我担心的是,实例化方法可能会导致问题,因为它不是文档中描述的方法。事实证明这不是问题所在。

     

什么问题是懒惰的复制和粘贴。当我从GA网站复制跟踪代码时,我不小心也复制了以下行。当这被复制到检查器中变量的单行文本框中时,跟踪代码显示为预期,但是有一条隐藏线也是字符串变量的一部分,无法看到。

     

啪的一声。

     

希望这一课能帮助另一个粗心的白痴避免相同或类似的错误。