I use firebase infrastructure as backend to process my in-app-purchases... as i have many gateways and accept offline payments i cannot rely only on google-billing to log the purchase events.
I would like to do it in my firebase function that process gateway payment status and updates the database, but seams that firebase analytics is not well imported to the cloud functions infrastructure
var firebase = require('firebase');
var analytics = firebase.initializeApp().analytics();
exports.teste = (req, res) => {
analytics.logEvent('analytics.EventName.PURCHASE', {
currency: 'BRL',
items: [{
item_id: 'sku'
}],
shipping: 1.00,
tax: 2.00,
transaction_id: 'SM_1234',
value: 20.0
});
let message = req.query.message || req.body.message || 'Hello World!';
res.status(200).send(message);
};
A 2020-06-25T20:50:37.613Z teste Provided module can't be loaded. teste
A 2020-06-25T20:50:37.613Z teste Is there a syntax error in your code? teste
the admin sdk doesn't include the analytics module.
is there any way to log the events in the cloud functions?