Google Analytics ইভেন্ট রিপোর্ট প্রদান করে, যা ব্যবহারকারীরা আপনার অ্যাপের সাথে কীভাবে ইন্টারঅ্যাক্ট করে তা বুঝতে সাহায্য করে। Cloud Functions (১ম জেনারেশন)-এর মাধ্যমে, আপনি অ্যাপল এবং অ্যান্ড্রয়েড ডিভাইস থেকে লগ করা কনভার্সন ইভেন্টগুলো অ্যাক্সেস করতে এবং সেই ইভেন্টগুলোর উপর ভিত্তি করে ফাংশন ট্রিগার করতে পারেন।
Google Analytics ফাংশন চালু করুন
Cloud Functions supports the Google Analytics AnalyticsEvent . This event is triggered whenever user activity generates a conversion event. For example, you could write a function that triggers when the in_app_purchase event is generated, indicating that an in-app purchase has occurred. You must specify the Analytics event that you want to trigger your function using the functions.analytics.event() method, and handle the event within the onLog() event handler:
exports.sendCouponOnPurchase = functions.analytics.event('in_app_purchase').onLog((event) => { // ... });
ইভেন্টের বৈশিষ্ট্য অ্যাক্সেস করুন
With each Analytics event, you have access to all relevant parameters and user properties. These include information about the user, the device, the app, and geographical information for the event. For the complete list of parameters and user properties, see the functions.analytics reference.
এই নমুনায় দেখানো ক্রয়-চালিত ফাংশনের জন্য, আপনি ব্যবহারকারীর ভাষা এবং ইভেন্টের মান ( valueInUSD )-এর মতো ইউজার অ্যাট্রিবিউটগুলো অ্যাক্সেস করতে চাইতে পারেন। এই দ্বিতীয় অ্যাট্রিবিউটটি নমুনা ফাংশনটিকে পরীক্ষা করতে সাহায্য করে যে এটি একটি উচ্চ-মূল্যের কনভার্সন ইভেন্ট কিনা, যাতে মূল্যবান গ্রাহকদের কাছে আরও উচ্চ-মূল্যের কুপন পাঠানো যায়।
/** * After a user has completed a purchase, send them a coupon via FCM valid on their next purchase. */ 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 = user.deviceInfo.userDefaultLanguage; // The user language in language-country format. // For purchases above 500 USD, we send a coupon of higher value. if (purchaseValue > 500) { return sendHighValueCouponViaFCM(uid, userLanguage); } return sendCouponViaFCM(uid, userLanguage); });
পরবর্তী পদক্ষেপ
Cloud Functions Analytics ইভেন্ট পরিচালনা সম্পর্কে আরও জানতে, Google Analytics ডকুমেন্টেশন এবং functions.analytics রেফারেন্স দেখুন, এবং coupon-on-purchase কোড স্যাম্পলটি চালিয়ে দেখুন।