如何从 Google-Analytics 迁移到 Firebase-Analytics? [英] How to move from Google-Analytics to Firebase-Analytics?

查看:22
本文介绍了如何从 Google-Analytics 迁移到 Firebase-Analytics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几个月,Google 发布了一个新的 Analytics 替代方案,名为Firebase 分析" .

In the recent months, Google has published a new Analytics alternative, called "Firebase Analytics" .

由于该应用已经有 Google-Analytics,我发现了一些我无法最好地处理的障碍.

As the app already does have Google-Analytics, I find some obstacles that I can't see how to best handle.

  1. 以前,newTracker"函数需要一个属性 ID.现在我看不到了.这是否意味着它不需要一个?

  1. Previously, "newTracker" function needed a property-id. Now I don't see it. Does it mean it doesn't need one?

以前,enableAdvertisingIdCollection"也可用于收集广告信息.我在新的 API 中找不到它.是自动收集的吗?

Previously, "enableAdvertisingIdCollection " was available to collect ads info too. I can't find it in new APIs. Is it automatically collected?

setDryRun"可用于禁止将数据发送到服务器,但现在我看不到它.这是否意味着应用程序的调试版本会自动采用这种方式?是否所有函数都写入日志?

"setDryRun" was available to disable sending the data to the servers, and now I don't see it. Does it mean it's automatically this way for debug versions of the app? Do all functions write to the logs?

以前,我可以跟踪屏幕":

Previously, I could track a "screen" :

public void setScreenName(String name) {
    mGoogleAnalyticsTracker.setScreenName(name);
    mGoogleAnalyticsTracker.send(new HitBuilders.ScreenViewBuilder().build());
}

现在我没有看到它,但正如我所读到的,我认为它是自动的,所以它无论如何都会发送活动生命周期的数据.是真的吗?

Now I don't see it, but as I've read, I think it's automatic, so it sends data of the activity lifecycle anyway. Is it true?

可能是最重要的事情:以前我可以使用类别、操作、标签和值进行跟踪:

Probably the most important thing: previously I could track using category, action, label and value:

public void trackEvent(final String category, final String action, final String label, final long value) {
    mGoogleAnalyticsTracker.send(new HitBuilders.EventBuilder()
            .setCategory(category).setAction(action)
            .setLabel(label).setValue(value).build());
}

现在我看到了一种完全不同的方式来跟踪事件(自定义事件"),使用 捆绑.示例:

and now I see a completely different way to track events ("custom events"), using bundles. Example:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);

它是如何工作的?它如何显示在 Firebase Analytics 网站 中?我想我可以让 logEvent 的第一个参数表现得像 Google-Analytics 的类别参数,但是我可以/应该为其余的做什么?根据文档,这应该没问题:

How does it work? How is it shown in the website of Firebase Analytics? I suppose I could have the first parameter of logEvent behave like the category parameter of the Google-Analytics, but what can/should I do for the rest? According to the docs, this should be ok:

public void trackEvent(final String category, final String action, final String label, final long value) {
    Bundle bundle = new Bundle();
    bundle.putString("action", action);
    bundle.putString("label", label);
    bundle.putLong("value", value);
    mFirebaseAnalytics.logEvent(category, bundle);
}

  • 实际上自动跟踪哪些事件(我问这个是因为有人说我不应该使用,此处) ?它们包括购买吗?应用程序邀请?广告?我在哪里可以在控制台网站上看到它们?

  • Which events are actually automatically being tracked (I ask this because some are said that I shouldn't use, here) ? Do they include purchases? app-invites? ads? Where do I see them in the console website ?

    关于日志,它说 新 SDK 通过以下方式实现:

    About logs, it says that the new SDK does it by :

    您可以使用一系列 adb 命令启用详细日志记录:

    You can enable verbose logging with a series of adb commands:

    adb shell setprop log.tag.FA VERBOSEadb shell setprop log.tag.FA-SVC VERBOSEadb logcat -v 时间 -s FA FA-SVC

    adb shell setprop log.tag.FA VERBOSE adb shell setprop log.tag.FA-SVC VERBOSE adb logcat -v time -s FA FA-SVC

    这些命令有什么作用?我怎样才能禁用它?我注意到它甚至显示在应用程序的发布版本中...

    What do those commands do? How can I disable it? I've noticed it even gets shown in release version of the app...

    新的 SDK 是否应该取代 Google-Analytics?是否建议完全转向它?Google-Analytics 会有任何更新吗?

    Is the new SDK supposed to replace Google-Analytics? Is it suggested to fully move to it? Will Google-Analytics have any updates?

    推荐答案

    很多问题捆绑在一起,所以我将尝试简要回答其中的大部分:

    Lots of questions bundled together so I'll try to briefly answer most of them:

    1. Google Analytics 报告跟踪器 ID,Firebase Analytics 报告应用程序.在您的 google-services.json 中定义的应用程序中只有一个 id.该 ID 被谷歌服务插件以google_app_id"名称转换为字符串资源.来自应用的所有事件都会报告给这个单一 ID.
    2. Firebase Analytics 会自动报告 AdId.您不需要启用它.
    3. 没有dryRun 功能.您可以在开发过程中使用单独的 google-services.json,使用应用版本过滤开发版本或添加 user-property 来标记用于开发的应用实例.
    4. 您可以使用

    1. Google Analytics reports on tracker-ids, Firebase Analytics reports on applications. There is only one id in the application defined in your google-services.json. The ID is translated to a string resource by google services plugin under "google_app_id" name. All events from the app are reported to this single id.
    2. Firebase Analytics reports AdId automatically. You don't need to enable it.
    3. There is no dryRun feature. You can either use separate google-services.json during development, filter out development version using the app version or add user-property to mark the app instances used for development.
    4. You can report screens with

    Bundle params = new Bundle();
    params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen");
    params.putString(FirebaseAnalytics.Param.ITEM_NAME, "screen name");
    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
    

  • 您可以使用相同的参数记录自定义事件

  • You can log custom event with the same params

    Bundle params = new Bundle();
    params.putString("category", category);
    params.putString("action", action);
    params.putString("label", label);
    params.putLong("value", value);
    firebaseAnalytics.logEvent("xyz_event", params);
    

    ga_"前缀是保留的,如果您使用它,您的分析将失败.例如,请使用xyz_",其中 xyz 是您公司的首字母缩写.

    The "ga_" prefix is reserved and your analytics will fail if you use it. Instead, use "xyz_" where xyz is your company's initials, for example.

    不要使用类别作为事件名称,除非您要跟踪的类别很少.Firebase Analytics 最多支持 500 个事件名称.记录更多会导致您的某些数据被忽略.

    Do not use the category as event name unless you have very few categories you want to track. Firebase Analytics supports up to 500 event names. Logging more than that will cause some of your data to be ignored.

    FirebaseAnalytics.Event 类.它大致代表报告的自动事件.

    There is a list of reserved event names in the beginning of the FirebaseAnalytics.Event class. It roughly represents the automatic events reported.

    Firebase Analytics 默认禁用调试日志记录.它只记录错误和警告.如果您未启用调试日志记录并且您的应用程序已正确配置,则在应用程序启动时只会记录 2 行,其中包含有关如何启用调试日志记录的说明.在生产中没有什么可以禁用的,也没有与 Google Analytics 中的 setLogLevel(ERROR) 等效的东西.WARN 是默认的日志记录级别.您只能通过在设备上运行 adb 命令来启用单个设备上的日志记录).这有助于您避免在启用调试日志记录的情况下在生产中发布应用.

    Firebase Analytics has debug logging disabled by default. It only logs errors and warnings. If you don't enable debug logging and your app is correctly configured there are only 2 lines that are being logged when the app starts with instructions on how to enable debug logging. There is nothing to disable in production and there is no equivalent to setLogLevel(ERROR) from Google Analytics. WARN is the default logging level. You can only enable logging on individual device by running the adb command on the device). That helps you avoid shipping app in production with debug logging enabled.

    适用于 Android 和 iOS 的 Google Analytics SDK 未弃用,并将在可预见的未来得到支持和更新.如果您已经投资在您的应用中使用它并且它满足您的需求,则您无需放弃它.

    Google Analytics SDK for Android and iOS is not deprecated and will be supported and updated for foreseeable future. You don't need to move away from it if you already invested using it in your app and it is meeting your needs.

    这篇关于如何从 Google-Analytics 迁移到 Firebase-Analytics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆