【问题标题】:Unity Google Analytics plugin works fine in Unity Editor, but doesn't log anything on AndroidUnity Google Analytics 插件在 Unity 编辑器中运行良好,但在 Android 上不记录任何内容
【发布时间】:2015-10-29 09:28:26
【问题描述】:

我已将谷歌分析插件添加到我的项目中。当我在 Unity 编辑器中运行它时,一切正常 - 我可以在 Google Analytics 网站的“实时”选项卡中看到 1 个人在桌面上玩。第二天,我可以在“受众”选项卡中看到所有数据。当我将它推送到我的 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 的数据,只有桌面。任何想法可能是什么原因?

【问题讨论】:

  • 只是检查,但您创建的应用程序 Google Analytics 帐户是正确的,而不是网站 Google Analytics 帐户。
  • 是的,我在我的 Google Analytics(分析)帐户上创建了移动应用媒体资源。

标签: unity3d google-analytics


【解决方案1】:

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

如果不是这个人,我永远不会发现: Google Analytics Unity Not Sending Hits

我遗漏了一些东西,我的方法没有任何问题。

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

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

打我一巴掌。

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

【讨论】:

    猜你喜欢
    • 2017-11-22
    • 1970-01-01
    • 2019-01-28
    • 2021-02-23
    • 1970-01-01
    • 2020-09-17
    • 1970-01-01
    • 1970-01-01
    • 2018-04-04
    相关资源
    最近更新 更多