提问人:Qasim Ali 提问时间:10/5/2023 最后编辑:Frank van PuffelenQasim Ali 更新时间:10/5/2023 访问量:42
有没有办法使用node js从firebase获取*app_remove*事件计数
Is there a way to get *app_remove* events count from firebase using node js
问:
我有兴趣跟踪我的应用的卸载次数。我观察到卸载在 Firebase Analytics 中被记录为“app_remove”事件。但是,我想使用 Node.js 或 Python 以编程方式检索这些事件的计数。是否有可用于此目的的方法或 API?
任何协助或指导将不胜感激。
谢谢。
我尝试了以下代码,但它总是说admin.analytis是未定义的。尽管我已经正确初始化了 firebase admin-sdk 并且已经使用它向用户发送推送通知。
const admin = require('firebase-admin');
// Initialize the Firebase Admin SDK.
admin.initializeApp(adminConfigs);
// Get the Firebase Analytics instance.
const analytics = admin.analytics();
// Get the app_remove event data.
const appRemoveEvents = await analytics.event('app_remove').get();
// Process the app_remove event data.
for (const event of appRemoveEvents) {
// Get the user's ID.
const userId = event.user.userId;
// ...
}
答:
0赞
Frank van Puffelen
10/5/2023
#1
根据适用于 Node.js 的 Firebase Admin SDK 的文档,其中没有组件,因此这解释了为什么您编写的代码不起作用。analytics
要从 Google Analytics(分析)中获取报告数据,您可以使用 Google Analytics(分析)数据 API (GA4) 。有许多平台可用的 SDK,包括 Node.js 和 Python。
评论