Exemplo n.º 1
0
        public static void TrackEvent(AdTraceEvent adtraceEvent)
        {
            AndroidJavaObject ajoAdTraceEvent = new AndroidJavaObject("io.adtrace.sdk.AdTraceEvent", adtraceEvent.eventToken);

            // Check if user has set revenue for the event.
            if (adtraceEvent.revenue != null)
            {
                ajoAdTraceEvent.Call("setRevenue", (double)adtraceEvent.revenue, adtraceEvent.currency);
            }

            // Check if user has added any callback parameters to the event.
            if (adtraceEvent.callbackList != null)
            {
                for (int i = 0; i < adtraceEvent.callbackList.Count; i += 2)
                {
                    string key   = adtraceEvent.callbackList[i];
                    string value = adtraceEvent.callbackList[i + 1];
                    ajoAdTraceEvent.Call("addCallbackParameter", key, value);
                }
            }

            // Check if user has added any partner parameters to the event.
            if (adtraceEvent.partnerList != null)
            {
                for (int i = 0; i < adtraceEvent.partnerList.Count; i += 2)
                {
                    string key   = adtraceEvent.partnerList[i];
                    string value = adtraceEvent.partnerList[i + 1];
                    ajoAdTraceEvent.Call("addPartnerParameter", key, value);
                }
            }

            // Check if user has added transaction ID to the event.
            if (adtraceEvent.transactionId != null)
            {
                ajoAdTraceEvent.Call("setOrderId", adtraceEvent.transactionId);
            }

            // Check if user has added callback ID to the event.
            if (adtraceEvent.callbackId != null)
            {
                ajoAdTraceEvent.Call("setCallbackId", adtraceEvent.callbackId);
            }

            // Check if user has added event value to the event.
            if (adtraceEvent.eventValue != null)
            {
                ajoAdTraceEvent.Call("setEventValue", adtraceEvent.eventValue);
            }

            // Track the event.
            ajcAdTrace.CallStatic("trackEvent", ajoAdTraceEvent);
        }
Exemplo n.º 2
0
        public static void TrackEvent(AdTraceEvent adtraceEvent)
        {
            int    isReceiptSet  = AdTraceUtils.ConvertBool(adtraceEvent.isReceiptSet);
            double revenue       = AdTraceUtils.ConvertDouble(adtraceEvent.revenue);
            string eventToken    = adtraceEvent.eventToken;
            string currency      = adtraceEvent.currency;
            string receipt       = adtraceEvent.receipt;
            string transactionId = adtraceEvent.transactionId;
            string callbackId    = adtraceEvent.callbackId;
            string stringJsonCallBackParameters = AdTraceUtils.ConvertListToJson(adtraceEvent.callbackList);
            string stringJsonPartnerParameters  = AdTraceUtils.ConvertListToJson(adtraceEvent.partnerList);

            _AdTraceTrackEvent(eventToken, revenue, currency, receipt, transactionId, callbackId, isReceiptSet, stringJsonCallBackParameters, stringJsonPartnerParameters);
        }
Exemplo n.º 3
0
        public static void trackEvent(AdTraceEvent adtraceEvent)
        {
            if (IsEditor())
            {
                return;
            }

            if (adtraceEvent == null)
            {
                Debug.Log("AdTrace: Missing event to track.");
                return;
            }
            #if UNITY_IOS
            AdTraceiOS.TrackEvent(adtraceEvent);
            #elif UNITY_ANDROID
            AdTraceAndroid.TrackEvent(adtraceEvent);
            #else
            Debug.Log(errorMsgPlatform);
            #endif
        }