| 1234567891011121314151617181920212223242526272829303132333435 |
- using Facebook.Unity;
- using UnityEngine;
- /// <summary>
- /// In-game Facebook funnel events. Stored in PlayerPrefs so Reset Save does not clear them.
- /// </summary>
- public static class ActivityFacebookEngagement
- {
- const string FirstLobbyReportedKey = "CrazyFruit.Activity.FirstLobbyReported";
- public static void TryReportFirstLobbyEntry()
- {
- if (PlayerPrefs.GetInt(FirstLobbyReportedKey, 0) != 0)
- return;
- if (!FB.IsInitialized)
- return;
- ActivityFacebookService.LogEvent("completeregistration", 0f);
- ActivityFacebookService.LogEvent("addtowishlist", 0f);
- PlayerPrefs.SetInt(FirstLobbyReportedKey, 1);
- PlayerPrefs.Save();
- }
- public static void ReportShopPurchase(int priceCoins)
- {
- if (!FB.IsInitialized)
- return;
- float value = Mathf.Max(0, priceCoins);
- ActivityFacebookService.LogEvent("addtocart", value);
- ActivityFacebookService.LogEvent("purchased", value);
- }
- }
|