Example #1
0
 public void adsPlayBackEvent()
 {
     AppsFlyer.trackRichEvent(AFInAppEvents.CONTENT_VIEW, new Dictionary <string, string>()
     {
         { AFInAppEvents.CONTENT_ID, "Ads_WatchNum" },
     });
 }
Example #2
0
 public void purchaserEvent(int id)
 {
     AppsFlyer.trackRichEvent(AFInAppEvents.PURCHASE, new Dictionary <string, string>()
     {
         { AFInAppEvents.CONTENT_ID, "" + payIDs[id] },
     });
 }
    public static void Purchase(string m_MapKey, string m_Key, string m_valoue)
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        eventValue.Add(m_Key, m_valoue);
        AppsFlyer.trackRichEvent(m_MapKey, eventValue);
    }
Example #4
0
    public void umengLevel(int state, int levelId)
    {
        AppsFlyer.trackRichEvent(AFInAppEvents.LEVEL_ACHIEVED, new Dictionary <string, string>()
        {
            { AFInAppEvents.CONTENT_ID, "GamesNum" },
        });
        if (state == 2)
        {
            Umeng.GA.StartLevel("Level_" + levelId);
        }
        else if (state == 0)
        {
            Umeng.GA.FailLevel("Level_" + levelId);
        }
        else if (state == 1)
        {
            Umeng.GA.FinishLevel("Level_" + levelId);

            AppsFlyer.trackRichEvent(AFInAppEvents.LEVEL_ACHIEVED, new Dictionary <string, string>()
            {
                { AFInAppEvents.CONTENT_ID, "Level_Num" },
            });
        }

        if (levelId > 35)
        {
            AppsFlyer.trackRichEvent(AFInAppEvents.LEVEL_ACHIEVED, new Dictionary <string, string>()
            {
                { AFInAppEvents.CONTENT_ID, "Player_ProNum" },
            });
        }
    }
    public void Ad_Click(string _type)
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        eventValue.Add("af_adrev_ad_type", _type);
        AppsFlyer.trackRichEvent("af_ad_click", eventValue);
    }
Example #6
0
    public void nextLevel()
    {
        string eventName = "af_fakeImpression";
        Dictionary <string, string> eventParams = new Dictionary <string, string>()
        {
            { "imp", "1" }
        };

        AppsFlyer.trackRichEvent(eventName, eventParams);
        Debug.Log("MAGIC");
        if (scenesInBuild.Contains(_nextlevel))
        {
            //Debug.Log("YES");
            SceneManager.LoadScene(_nextlevel, LoadSceneMode.Single);
        }
        else
        {
            //Debug.Log("error");
            SceneManager.LoadScene("Main", LoadSceneMode.Single);
        }

        /* int a = lvlname[2] - '0' + 1;
         * //    if (string.Compare(lvlname[2].ToString(),"9")==0 && scenesInBuild.Contains(lvlname[0].ToString() + ((lvlname[2] - '0' + 1)).ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString()))
         * //    {
         * //        SceneManager.LoadScene(lvlname[0].ToString() + ((lvlname[1] - '0' + 1)).ToString() + ('0').ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString(), LoadSceneMode.Single);
         * //
         * //        lvlname[4] = lvlname[4] != '0' ? '0' : '0';
         * //        if (string.Compare(PlayerPrefs.GetString("LEVEL"), lvlname[0].ToString() + ((lvlname[1] - '0' + 1)).ToString() + ('0').ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString()) <= 0)
         * //        {
         * //            PlayerPrefs.SetString("LEVEL", lvlname[0].ToString() + ((lvlname[1] - '0' + 1)).ToString() + ('0').ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString());
         * //           Debug.Log("here1");
         * //        }
         * //        else
         * //            Debug.Log("BAD1");
         * //   }
         * if (a > 9)
         * {
         *       //lvlname[4] = (char)(a / 10);
         *       //lvlname[5] = (char)(a % 10);
         *       SceneManager.LoadScene(lvlname[0].ToString()+a.ToString()+lvlname[3].ToString()+('0').ToString()+('1').ToString(), LoadSceneMode.Single);
         *   PlayerPrefs.SetString("LEVEL","l0-01");
         * }
         *
         * else if (scenesInBuild.Contains(lvlname[0].ToString() + lvlname[1].ToString() + ((lvlname[2] - '0' + 1)).ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString()))
         * {
         *   SceneManager.LoadScene(lvlname[0].ToString() + lvlname[1].ToString() + ((lvlname[2] - '0' + 1)).ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString(), LoadSceneMode.Single);
         *
         *   lvlname[4]=lvlname[4] != '0' ? '0' : '0';
         *   if (string.Compare(PlayerPrefs.GetString("LEVEL"), lvlname[0].ToString() + lvlname[1].ToString() + ((lvlname[2] - '0' + 1)).ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString()) <= 0)
         *   {
         *       PlayerPrefs.SetString("LEVEL", lvlname[0].ToString() + lvlname[1].ToString() + ((lvlname[2] - '0' + 1)).ToString() + lvlname[3].ToString() + lvlname[4].ToString() + ('1').ToString());
         *       Debug.Log("Here2");
         *
         *   }
         *   else
         *       Debug.Log("Bad2");
         * }
         * else
         *   SceneManager.LoadScene("Main", LoadSceneMode.Single);*/
    }
Example #7
0
 public void InitializeAppsFlyer()
 {
     if (!base.Inited)
     {
         AppsFlyer.initSDK("nr8SibwpFjcKGBQNpDdttd", "com.futureplay.minecraft");
         AppsFlyer.setCustomerUserId(PlayerData.Instance.PlayerId);
         AppsFlyer.trackAppLaunch();
         PlayerData.Instance.DaysRetained.Skip(1).Subscribe(delegate(int days)
         {
             AppsFlyer.trackRichEvent("Retained_Day", new Dictionary <string, string>
             {
                 {
                     "Day",
                     days.ToString()
                 }
             });
         });
         (from res in PersistentSingleton <AdService> .Instance.AdResults
          where res.result == AdService.V2PShowResult.Finished
          select res).Subscribe(delegate(AdWatched adWatched)
         {
             AppsFlyer.trackRichEvent("Ad_Watched", adWatched.asDictionary());
         });
         base.Inited = true;
     }
 }
Example #8
0
 public void CustomEventDic(string eventId, Dictionary <string, string> dic)
 {
     if (dic != null)
     {
         AppsFlyer.trackRichEvent(eventId, dic);
     }
 }
Example #9
0
        public override void HandleNotification(INotification notification)
        {
            var msgName = notification.name;

            switch (msgName)
            {
            case IAP_MSG.PURCHASE_SUCCESS:
                //////////////////////////////////////////////////////////////
                //// 应用内事件:记录购买的产品 ///////////////////////////////////
                //////////////////////////////////////////////////////////////
                // 只要购买成功, NonComsumable 类型的产品的购买信息,会被 komal 框架记录下来。可以通过
                // SDKManager.Instance.IsPurchased("remove_ads"); 这样的接口获取状态;
                IAPSuccessResult result = (IAPSuccessResult)notification.body;
                var product             = result.product;     // Unity IAP 返回的产品数据结构;
                var productKey          = result.productKey;  // 配置 IDConfig.cs 中用于程序购买的关键字(remove_ads)
                var productItem         = result.productItem; // 配置 IDConfig.cs 中,在 app store 上填写的信息;
                // 不是恢复购买的情况下
                if (!result.isRestore)
                {
                    // 向 AppsFlyer 发送消息
                    this.SendPurchaseEvent(productItem.ID,
                                           productItem.Type,
                                           productItem.Price.ToString(),
                                           productItem.Currency);
                }
                break;

            case MSG_GAMECENTER.GAMECENTER_LOGIN_SUCCESS:
                //////////////////////////////////////////////////////////////
                //// 应用内事件:记录登陆成功事件 /////////////////////////////////
                //////////////////////////////////////////////////////////////
                AppsFlyer.trackRichEvent("af_login", null);
                break;
            }
        }
    public void Tutorial_Completion()
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        eventValue.Add(AFInAppEvents.SUCCESS, "Complete");
        eventValue.Add(AFInAppEvents.CONTENT_ID, "Tutorial");
        AppsFlyer.trackRichEvent(AFInAppEvents.TUTORIAL_COMPLETION, eventValue);
    }
    public void Level_Achieved(string _level)
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        eventValue.Add(AFInAppEvents.LEVEL, _level);
        //eventValue.Add(AFInAppEvents.SCORE, "category_a");
        AppsFlyer.trackRichEvent(AFInAppEvents.LEVEL_ACHIEVED, eventValue);
    }
Example #12
0
    public static void TrackEvent(string EventName, Dictionary <string, string> currentEventData)
    {
#if UNITY_EDITOR
        //Debug.LogError("EventName :: " + EventName);
#elif UNITY_ANDROID
        AppsFlyer.trackRichEvent(EventName, currentEventData);
#endif
    }
Example #13
0
        //public void LogAddedToCartEvent(string contentId, string contentType, string currency, double price)
        //{

        //}

        public void LogEvent(UBSEventKeyName key_)
        {
            SetAppsFlyerDedicatedData();

            Dictionary <UBSParamKeyName, object> raw_params = AppendBaseData();

            AppsFlyer.trackRichEvent(TranslateEventKey(key_), TranslateParamData(raw_params));
        }
Example #14
0
 public void sendAFEvent()
 {
     /* Send events */
     System.Collections.Generic.Dictionary <string, string> purchaseEvent = new System.Collections.Generic.Dictionary <string, string>();
     purchaseEvent.Add("af_currency", "USD");
     purchaseEvent.Add("af_revenue", "0.99");
     purchaseEvent.Add("af_quantity", "1");
     AppsFlyer.trackRichEvent("af_purchase", purchaseEvent);
 }
Example #15
0
 void SendPurchaseEvent(string currency, string price, string rewardAmount)
 {
     System.Collections.Generic.Dictionary <string, string> purchaseEvent = new
                                                                            System.Collections.Generic.Dictionary <string, string>();
     purchaseEvent.Add("af_currency", currency);     //"USD");
     purchaseEvent.Add("af_revenue", price);         //"0.99");
     purchaseEvent.Add("af_quantity", rewardAmount); // "1");
     AppsFlyer.trackRichEvent("af_purchase", purchaseEvent);
 }
Example #16
0
    public void TrackAd(string getCoin, string count)
    {
        Dictionary <string, string> adEvent = new Dictionary <string, string>();

        adEvent.Add("af_revenue", "0");
        adEvent.Add("af_quantity", count);
        AppsFlyer.trackRichEvent("af_param_1", adEvent);

        //AppsFlyer.trackEvent(AFInAppEvents.LOGIN);
    }
Example #17
0
        public void Pay(double cash, double coin)
        {
            Dictionary <string, string> eventValue = new Dictionary <string, string>();

            eventValue.Add("af_revenue", cash.ToString());
            eventValue.Add("af_content_id", coin.ToString());
            eventValue.Add("af_currency", "USD");

            AppsFlyer.trackRichEvent("af_purchase", eventValue);
        }
Example #18
0
        public void CustomEvent(string eventID, string label = null)
        {
            Dictionary <string, string> eventValue = new Dictionary <string, string>();

            if (label != null)
            {
                eventValue.Add("description", label);
            }
            AppsFlyer.trackRichEvent(eventID, eventValue);
        }
    public void Purchaser(string _id, string _content, string _price, string _currency, string _dateCheckIn)
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        eventValue.Add(AFInAppEvents.CONTENT_ID, _id);
        eventValue.Add(AFInAppEvents.CONTENT_TYPE, _content);
        eventValue.Add(AFInAppEvents.REVENUE, _price);
        eventValue.Add(AFInAppEvents.CURRENCY, _currency);
        eventValue.Add(AFInAppEvents.DATE_A, _dateCheckIn);
        AppsFlyer.trackRichEvent(AFInAppEvents.PURCHASE, eventValue);
    }
Example #20
0
    // Update is called once per frame
    //   void Update () {
    //	if (Input.GetKeyDown (KeyCode.Escape)) {
    //		//go to background when pressing back button
    //		#if UNITY_ANDROID
    //		AndroidJavaObject activity =
    //			new AndroidJavaClass("com.unity3d.player.UnityPlayer")
    //				.GetStatic<AndroidJavaObject>("currentActivity");
    //		activity.Call<bool>("moveTaskToBack", true);
    //		#endif
    //	}


    //	#if UNITY_IOS
    //	if (!tokenSent) {
    //		byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;
    //		if (token != null) {
    //		//For iOS uninstall
    //			AppsFlyer.registerUninstall (token);
    //			tokenSent = true;
    //		}
    //	}
    //	#endif
    //}

    //A custom event tracking

    public void TrackIAP(string price, string count)
    {
        Dictionary <string, string> purchaseEvent = new Dictionary <string, string>();

        purchaseEvent.Add("af_currency", "USD");
        purchaseEvent.Add("af_revenue", price);
        purchaseEvent.Add("af_quantity", count);
        AppsFlyer.trackRichEvent("af_purchase", purchaseEvent);

        //AFInAppEvents.LEVEL_ACHIEVED
    }
Example #21
0
    //A custom event tracking
    public void Purchase()
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string> ();

        eventValue.Add("af_revenue", "200");
        eventValue.Add("af_content_type", "category_a");
        eventValue.Add("af_content_id", "1234567");
        eventValue.Add("af_currency", "USD");
        AppsFlyer.trackRichEvent("af_purchase", eventValue);
        AF_Sample_BGScript.pressed();
    }
Example #22
0
            public void ProductPurchased(string price, string currencyCode, string productCode)
            {
                Dictionary <string, string> eventValues = new Dictionary <string, string> ();

                eventValues.Add("af_price", price.ToString());
                eventValues.Add("af_currency", currencyCode);
                eventValues.Add("af_content_id", productCode);
                eventValues.Add("af_revenue", price.ToString());

                AppsFlyer.trackRichEvent("af_purchase", eventValues);
            }
Example #23
0
 public void Purchase(PremiumProduct product)
 {
     if (this.initialized)
     {
         Dictionary <string, string> dictionary2 = new Dictionary <string, string>();
         dictionary2.Add("af_revenue", string.Empty + product.trackingAmount);
         dictionary2.Add("af_content_id", product.flareProductId);
         dictionary2.Add("af_currency", product.trackingIsoCurrencyCode);
         Dictionary <string, string> eventValues = dictionary2;
         AppsFlyer.trackRichEvent("af_purchase", eventValues);
     }
 }
Example #24
0
        private bool PurchaseEvent(UBSEventKeyName event_name_, float?value_, Dictionary <UBSParamKeyName, object> params_ = null)
        {
            if (null != value_ && UBSEventKeyName.Purchased == event_name_)
            {
                Dictionary <string, string> additional_params = TranslateParamData(params_);
                additional_params[AFInAppEvents.REVENUE] = value_.ToString();
                AppsFlyer.trackRichEvent(TranslateEventKey(event_name_), additional_params);
                return(true);
            }

            return(false);
        }
Example #25
0
 /*
  *  productId: 商品 ID
  *  contentType: 商品分类
  *  revenue: 收入,可以为负数
  *  currency: 货币类型
  */
 public void SendPurchaseEvent(string productId, string contentType, string revenue, string currency = "USD")
 {
     // 高级属性数据发送的开关
     if (this.m_isAdvancedToggleOn)
     {
         Dictionary <string, string> eventDict = new Dictionary <string, string> ();
         eventDict.Add(AFInAppEvents.REVENUE, revenue);
         eventDict.Add(AFInAppEvents.CONTENT_TYPE, contentType);
         eventDict.Add(AFInAppEvents.CONTENT_ID, productId);
         eventDict.Add(AFInAppEvents.CURRENCY, currency);
         AppsFlyer.trackRichEvent(AFInAppEvents.PURCHASE, eventDict);
     }
 }
Example #26
0
    public void AppsFlyerEvent(string type, params object[] args)
    {
        Dictionary <string, string> eventValue = new Dictionary <string, string>();

        if (args != null && args.Length > 0)
        {
            for (int i = 0; i < args.Length; i += 2)
            {
                eventValue.Add(args[i].ToString(), args[i + 1].ToString());
            }
        }
        AppsFlyer.trackRichEvent(type, eventValue);
    }
Example #27
0
    public void LevelAccomplished()
    {
        DataScript.gameOverLock = false;
        FB.LogAppEvent(AppEventName.AchievedLevel, (float)DataScript.currentLevel);
        levelAccomplishedPanel.SetActive(true);
        DataScript.isGamePaused = true;


        Dictionary <string, string> levelAchieved = new Dictionary <string, string>();

        levelAchieved.Add("af_AchievedLevel", DataScript.currentLevel.ToString());
        AppsFlyer.trackRichEvent("af_levelAchieved", levelAchieved);
    }
Example #28
0
 public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight)
 {
                 #if APPSFLYER_ANALYTICS_API
     AppsFlyer.trackRichEvent(string.Format("Screen: {0} (ID: {1}) - {2}", FlowSystem.GetWindow(screenId).title, screenId, group1), new Dictionary <string, string>()
     {
         { "Group1", group1 },
         { "Group2", group2 },
         { "Group3", group3 },
         { "Weight", weight.ToString() },
         { "CustomParameter", User.instance.customParameter },
     });
                 #endif
     yield return(0);
 }
Example #29
0
 public override System.Collections.Generic.IEnumerator <byte> OnEvent(string eventName, string group1, string group2, string group3, int weight)
 {
                 #if APPSFLYER_ANALYTICS_API
     AppsFlyer.trackRichEvent(string.Format("{0}: {1}", eventName, group1), new Dictionary <string, string>()
     {
         { "Group1", group1 },
         { "Group2", group2 },
         { "Group3", group3 },
         { "Weight", weight.ToString() },
         { "CustomParameter", User.instance.customParameter },
     });
                 #endif
     yield return(0);
 }
Example #30
0
    public static void TrackEvent(string EventName, string[] keys, string[] values)
    {
        Dictionary <string, string> currentEventData = new Dictionary <string, string>();

        for (int i = 0; i < keys.Length; i++)
        {
            currentEventData.Add(keys[i], values[i]);
        }
#if UNITY_EDITOR
        //Debug.LogError("EventName :: " + EventName);
#elif UNITY_ANDROID
        AppsFlyer.trackRichEvent(EventName, currentEventData);
#endif
    }