且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Firebase分析日志事件在电子生产版本中不起作用

更新时间:2023-11-17 23:04:52

有类似电子的问题,当我们在开发模式下运行应用程序时,由于该应用程序在localhost:3000上运行,因此它将轻松记录firebase事件.工作.

There is issue like in electron, When we run app in development mode it will log firebase event easily because the app is run on localhost:3000 so a event will work.

但是当我们为mac/windows创建构建时,它不会记录该事件,因为 firebase 当构建运行在 http 协议上并且我们的电子应用产品构建运行 file://协议

But when we create a build for mac/windows it will not log the event because firebase package work when a build run on http protocol and our electron app production build run a file:// protocol.

因此,在这里我们必须使用Measurement Protocol,因为我们需要在firebase应用中创建一个单独的属性.

So here we have to use Measurement Protocol, In that we need to create a separate property in firebase app.

创建属性的步骤:

  1. 转到analytics.google.com,然后创建一个Firebase应用.
  2. 单击创建属性",然后选择网站选项.
  3. 提供网站URl和财产名称.

之后,您将获得跟踪信息.因此,跟踪代码将可用.

After the you will get a tracking info.In that a tracking code will be available.

然后在主要流程中使用通用分析.

Then use universal-analytics in main Processes.

这是完整的实现. https://kilianvalkhof.com/2018/apps/using-google-analytics-to-gather-usage-statistics-in-electron/