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

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

问题描述

在最近几个月中,Google发布了一种新的Google Analytics备选方案,名为 Firebase Analytics



问题



由于该应用程序已经有Google Analytics,因此我发现了一些障碍,我无法看到如何最好地处理。

h2>


  1. 以前,newTracker函数需要一个property-id。现在我没有看到它。这是否意味着它不需要?

  2. 以前,enableAdvertisingIdCollection也可用于收集广告信息。我无法在新的API中找到它。它是否自动收集?
  3. setDryRun可用于禁用将数据发送到服务器,现在我看不到它。这是否意味着它会自动以这种方式调试应用程序的版本?所有功能都写入日志吗?


  4. 以前,我可以跟踪一个屏幕:

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

    现在我没有看到它,但正如我读过的,认为它是自动的,所以它无论如何都会发送活动生命周期的数据。是真的吗?可能最重要的是:以前我可以使用类别,动作,标签和值进行跟踪:

      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());
    }

    现在我看到了一种完全不同的方式来跟踪事件(自定义事件 ),请使用 软件包 。例子:

      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的第一个参数表现得像谷歌分析的类别参数,但是我可以/应该为剩下的做​​些什么?根据文档,这应该是好的:

      public void trackEvent(final String category,final String action,final String label,最终长期价值){
    Bundle bundle = new Bundle();
    bundle.putString(action,action);
    bundle.putString(label,label);
    bundle.putLong(value,value);
    mFirebaseAnalytics.logEvent(category,bundle);


  5. 实际上会自动跟踪哪些事件据说我不应该使用 此处 )?他们是否包括购买? APP-邀请?广告?我在哪里可以在控制台网站上看到他们?

  6. 关于日志, it



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

    这些命令有什么作用?我该如何禁用它?我注意到它甚至在应用程序的发布版本中显示出来......

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

    因此我会尽量简要地回答其中的大部分内容:


    1. Google Analytics会报告跟踪代码ids和Firebase Analytics关于应用程序的报告。在google-services.json中定义的应用程序中只有一个id。该ID通过google服务插件在google_app_id名称下翻译为字符串资源。来自应用的所有活动都会报告给此单一ID。

    2. Firebase Analytics会自动报告AdId。您不需要启用它。

    3. 没有dryRun功能。您可以在开发过程中使用单独的google-services.json,使用应用版本过滤掉开发版本,也可以添加用户属性来标记用于开发的应用实例。

    4. 您可以报告屏幕




      Bundle params = new Bundle(); params.putString(FirebaseAnalytics.PARAM.ITEM_CATEGORY,screen); 
    params.putString(FirebaseAnalytics.PARAM.ITEM_NAME,屏幕名称);
    firebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM,params);





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


    $ b


      Bundle params =新的Bundle(); 
    params.putString(category,category);
    params.putString(action,action);
    params.putString(label,label);
    params.putLong(value,value);
    firebaseAnalytics.logEvent(ga_event,params);


    不要将该类别用作事件名称,除非您的数量很少你想跟踪的类别。 Firebase Analytics最多可支持500个活动名称。记录更多,然后这会导致您的一些数据被忽略。


    1. 有一个保留列表 FirebaseAnalytics.Event类开头的事件名称。它大致代表所报告的自动事件。

    2. Firebase Analytics默认情况下禁用了调试日志记录功能。它只记录错误和警告。如果您未启用调试日志记录并且您的应用程序配置正确,那么当应用程序以关于如何启用调试日志记录的说明开始时,只有两行记录。生产中没有什么可禁用的,并且没有等同于Google Analytics的setLogLevel(ERROR)。 WARN是默认的日志记录级别。您只能通过在设备上运行adb命令来启用单个设备上的日志记录功能)。这可以帮助您避免在生产中使用调试日志记录发送应用程序。 Android和iOS的Google AnalyticsSDK不会被弃用,并且在可预见的将来会得到支持和更新。如果您已经在应用程序中投入使用它,并且满足您的需求,则无需离开它。


    Background

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

    The problem

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

    The questions

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

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

    3. "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?

    4. 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?

    5. 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);
      

      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);
      }
      

    6. 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 ?

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

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

      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...

    8. 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 bundles together so I'll try to briefly answer most of them:

    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 reports 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);
    

    1. 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("ga_event", params);
    

    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 then that will cause some of your data to be ignored.

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

    2. 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.

    3. 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天全站免登陆