June 2018
Beginner to intermediate
394 pages
9h 2m
English
Functions can be triggered when a particular custom event is fired. For example, if your application user purchases something, and you make revenue through that, you can fire a thank-you notification and mail inside the following code snippet:
exports.sendCouponOnPurchase = functions.analytics.event('in_app_purchase').onLog((event) => { // ...});
If you want to access event properties, do that through the following code snippet:
exports.sendCouponOnPurchase = functions.analytics.event('in_app_purchase').onLog((event) => { const user = event.user; const uid = user.userId; // The user ID set via the setUserId API. const purchaseValue = event.valueInUSD; // Amount of the purchase in USD. const userLanguage ...
Read now
Unlock full access