Firebase analytics log events with cloud functions [duplicate]

為{幸葍}努か 提交于 2020-06-20 16:34:16

问题


I'm using google cloud functions as backend to process my app orders and connect with gateway payment to accept/deny purchases...

Everything is working fine. but i would like to register the purchase events to firebase analytics so i can monitore all app revenue in the same dashboard in firebase

on android I can do something like:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.VALUE, value);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.PURCHASE, bundle);

then it will appears in my dashboard... the problem is i want to register this event ONLY WHEN the user paid for the purchase, so it can be done from the app, it must be set after the payment gateway returns to my backend with the payment status

I'm using google cloud functions with node js as backend and i would like to know how can i register an firebase analytics event from there


回答1:


There is no SDK to send events to Google Analytics for Firebase from Node.js/Cloud Functions. The only way I can see is to export your Firebase Analytics to BigQuery, and then write to BigQuery from Cloud Functions too. Then you can perform queries on the combined data in BigQuery.

Also see:

  • Can I track my Firebase function in Google Analytics?
  • Firebase - log events from server side cloud functions
  • Firebase analytics from remote REST API?


来源:https://stackoverflow.com/questions/53688942/firebase-analytics-log-events-with-cloud-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!