예제 #1
0
        public AdTraceSessionFailure(string jsonString)
        {
            var jsonNode = JSON.Parse(jsonString);

            if (jsonNode == null)
            {
                return;
            }

            Adid      = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyAdid);
            Message   = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyMessage);
            Timestamp = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyTimestamp);
            WillRetry = Convert.ToBoolean(AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyWillRetry));

            var jsonResponseNode = jsonNode[AdTraceUtils.KeyJsonResponse];

            if (jsonResponseNode == null)
            {
                return;
            }
            if (jsonResponseNode.AsObject == null)
            {
                return;
            }

            JsonResponse = new Dictionary <string, object>();
            AdTraceUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
        }
예제 #2
0
        public AdTraceSessionFailure(Dictionary <string, string> sessionFailureDataMap)
        {
            if (sessionFailureDataMap == null)
            {
                return;
            }

            Adid      = AdTraceUtils.TryGetValue(sessionFailureDataMap, AdTraceUtils.KeyAdid);
            Message   = AdTraceUtils.TryGetValue(sessionFailureDataMap, AdTraceUtils.KeyMessage);
            Timestamp = AdTraceUtils.TryGetValue(sessionFailureDataMap, AdTraceUtils.KeyTimestamp);

            bool willRetry;

            if (bool.TryParse(AdTraceUtils.TryGetValue(sessionFailureDataMap, AdTraceUtils.KeyWillRetry), out willRetry))
            {
                WillRetry = willRetry;
            }

            string jsonResponseString = AdTraceUtils.TryGetValue(sessionFailureDataMap, AdTraceUtils.KeyJsonResponse);
            var    jsonResponseNode   = JSON.Parse(jsonResponseString);

            if (jsonResponseNode != null && jsonResponseNode.AsObject != null)
            {
                JsonResponse = new Dictionary <string, object>();
                AdTraceUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
            }
        }
        public AdTraceEventSuccess(string jsonString)
        {
            var jsonNode = JSON.Parse(jsonString);

            if (jsonNode == null)
            {
                return;
            }

            Adid       = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyAdid);
            Message    = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyMessage);
            Timestamp  = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyTimestamp);
            EventToken = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyEventToken);
            CallbackId = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyCallbackId);

            var jsonResponseNode = jsonNode[AdTraceUtils.KeyJsonResponse];

            if (jsonResponseNode == null)
            {
                return;
            }
            if (jsonResponseNode.AsObject == null)
            {
                return;
            }

            JsonResponse = new Dictionary <string, object>();
            AdTraceUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
        }
예제 #4
0
        public void BuildJsonResponseFromString(string jsonResponseString)
        {
            var jsonNode = JSON.Parse(jsonResponseString);

            if (jsonNode == null)
            {
                return;
            }

            JsonResponse = new Dictionary <string, object>();
            AdTraceUtils.WriteJsonResponseDictionary(jsonNode.AsObject, JsonResponse);
        }
예제 #5
0
        public static void Start(AdTraceConfig adtraceConfig)
        {
            string appToken                              = adtraceConfig.appToken != null ? adtraceConfig.appToken : "ADT_INVALID";
            string sceneName                             = adtraceConfig.sceneName != null ? adtraceConfig.sceneName : "ADT_INVALID";
            string userAgent                             = adtraceConfig.userAgent != null ? adtraceConfig.userAgent : "ADT_INVALID";
            string defaultTracker                        = adtraceConfig.defaultTracker != null ? adtraceConfig.defaultTracker : "ADT_INVALID";
            string environment                           = adtraceConfig.environment.ToLowercaseString();
            long   info1                                 = AdTraceUtils.ConvertLong(adtraceConfig.info1);
            long   info2                                 = AdTraceUtils.ConvertLong(adtraceConfig.info2);
            long   info3                                 = AdTraceUtils.ConvertLong(adtraceConfig.info3);
            long   info4                                 = AdTraceUtils.ConvertLong(adtraceConfig.info4);
            long   secretId                              = AdTraceUtils.ConvertLong(adtraceConfig.secretId);
            double delayStart                            = AdTraceUtils.ConvertDouble(adtraceConfig.delayStart);
            int    logLevel                              = AdTraceUtils.ConvertLogLevel(adtraceConfig.logLevel);
            int    isDeviceKnown                         = AdTraceUtils.ConvertBool(adtraceConfig.isDeviceKnown);
            int    sendInBackground                      = AdTraceUtils.ConvertBool(adtraceConfig.sendInBackground);
            int    eventBufferingEnabled                 = AdTraceUtils.ConvertBool(adtraceConfig.eventBufferingEnabled);
            int    allowSuppressLogLevel                 = AdTraceUtils.ConvertBool(adtraceConfig.allowSuppressLogLevel);
            int    launchDeferredDeeplink                = AdTraceUtils.ConvertBool(adtraceConfig.launchDeferredDeeplink);
            int    isAttributionCallbackImplemented      = AdTraceUtils.ConvertBool(adtraceConfig.getAttributionChangedDelegate() != null);
            int    isEventSuccessCallbackImplemented     = AdTraceUtils.ConvertBool(adtraceConfig.getEventSuccessDelegate() != null);
            int    isEventFailureCallbackImplemented     = AdTraceUtils.ConvertBool(adtraceConfig.getEventFailureDelegate() != null);
            int    isSessionSuccessCallbackImplemented   = AdTraceUtils.ConvertBool(adtraceConfig.getSessionSuccessDelegate() != null);
            int    isSessionFailureCallbackImplemented   = AdTraceUtils.ConvertBool(adtraceConfig.getSessionFailureDelegate() != null);
            int    isDeferredDeeplinkCallbackImplemented = AdTraceUtils.ConvertBool(adtraceConfig.getDeferredDeeplinkDelegate() != null);

            _AdTraceLaunchApp(
                appToken,
                environment,
                sdkPrefix,
                userAgent,
                defaultTracker,
                sceneName,
                allowSuppressLogLevel,
                logLevel,
                isDeviceKnown,
                eventBufferingEnabled,
                sendInBackground,
                secretId,
                info1,
                info2,
                info3,
                info4,
                delayStart,
                launchDeferredDeeplink,
                isAttributionCallbackImplemented,
                isEventSuccessCallbackImplemented,
                isEventFailureCallbackImplemented,
                isSessionSuccessCallbackImplemented,
                isSessionFailureCallbackImplemented,
                isDeferredDeeplinkCallbackImplemented);
        }
예제 #6
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);
        }
예제 #7
0
        public AdTraceAttribution(Dictionary <string, string> dicAttributionData)
        {
            if (dicAttributionData == null)
            {
                return;
            }

            trackerName  = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyTrackerName);
            trackerToken = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyTrackerToken);
            network      = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyNetwork);
            campaign     = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyCampaign);
            adgroup      = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyAdgroup);
            creative     = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyCreative);
            clickLabel   = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyClickLabel);
            adid         = AdTraceUtils.TryGetValue(dicAttributionData, AdTraceUtils.KeyAdid);
        }
예제 #8
0
        public AdTraceAttribution(string jsonString)
        {
            var jsonNode = JSON.Parse(jsonString);

            if (jsonNode == null)
            {
                return;
            }

            trackerName  = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyTrackerName);
            trackerToken = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyTrackerToken);
            network      = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyNetwork);
            campaign     = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyCampaign);
            adgroup      = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyAdgroup);
            creative     = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyCreative);
            clickLabel   = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyClickLabel);
            adid         = AdTraceUtils.GetJsonString(jsonNode, AdTraceUtils.KeyAdid);
        }
예제 #9
0
        public AdTraceSessionSuccess(Dictionary <string, string> sessionSuccessDataMap)
        {
            if (sessionSuccessDataMap == null)
            {
                return;
            }

            Adid      = AdTraceUtils.TryGetValue(sessionSuccessDataMap, AdTraceUtils.KeyAdid);
            Message   = AdTraceUtils.TryGetValue(sessionSuccessDataMap, AdTraceUtils.KeyMessage);
            Timestamp = AdTraceUtils.TryGetValue(sessionSuccessDataMap, AdTraceUtils.KeyTimestamp);

            string jsonResponseString = AdTraceUtils.TryGetValue(sessionSuccessDataMap, AdTraceUtils.KeyJsonResponse);
            var    jsonResponseNode   = JSON.Parse(jsonResponseString);

            if (jsonResponseNode != null && jsonResponseNode.AsObject != null)
            {
                JsonResponse = new Dictionary <string, object>();
                AdTraceUtils.WriteJsonResponseDictionary(jsonResponseNode.AsObject, JsonResponse);
            }
        }
예제 #10
0
        // Used for testing only.
        public static void SetTestOptions(Dictionary <string, string> testOptions)
        {
            AndroidJavaObject ajoTestOptions = AdTraceUtils.TestOptionsMap2AndroidJavaObject(testOptions, ajoCurrentActivity);

            ajcAdTrace.CallStatic("setTestOptions", ajoTestOptions);
        }
예제 #11
0
        // Used for testing only.
        public static void SetTestOptions(Dictionary <string, string> testOptions)
        {
            string baseUrl             = testOptions[AdTraceUtils.KeyTestOptionsBaseUrl];
            string gdprUrl             = testOptions[AdTraceUtils.KeyTestOptionsGdprUrl];
            string basePath            = testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsBasePath) ? testOptions[AdTraceUtils.KeyTestOptionsBasePath] : null;
            string gdprPath            = testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsGdprPath) ? testOptions[AdTraceUtils.KeyTestOptionsGdprPath] : null;
            long   timerIntervalMilis  = -1;
            long   timerStartMilis     = -1;
            long   sessionIntMilis     = -1;
            long   subsessionIntMilis  = -1;
            bool   teardown            = false;
            bool   deleteState         = false;
            bool   noBackoffWait       = false;
            bool   iAdFrameworkEnabled = false;

            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsTimerIntervalInMilliseconds))
            {
                timerIntervalMilis = long.Parse(testOptions[AdTraceUtils.KeyTestOptionsTimerIntervalInMilliseconds]);
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsTimerStartInMilliseconds))
            {
                timerStartMilis = long.Parse(testOptions[AdTraceUtils.KeyTestOptionsTimerStartInMilliseconds]);
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsSessionIntervalInMilliseconds))
            {
                sessionIntMilis = long.Parse(testOptions[AdTraceUtils.KeyTestOptionsSessionIntervalInMilliseconds]);
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsSubsessionIntervalInMilliseconds))
            {
                subsessionIntMilis = long.Parse(testOptions[AdTraceUtils.KeyTestOptionsSubsessionIntervalInMilliseconds]);
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsTeardown))
            {
                teardown = testOptions[AdTraceUtils.KeyTestOptionsTeardown].ToLower() == "true";
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsDeleteState))
            {
                deleteState = testOptions[AdTraceUtils.KeyTestOptionsDeleteState].ToLower() == "true";
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsNoBackoffWait))
            {
                noBackoffWait = testOptions[AdTraceUtils.KeyTestOptionsNoBackoffWait].ToLower() == "true";
            }
            if (testOptions.ContainsKey(AdTraceUtils.KeyTestOptionsiAdFrameworkEnabled))
            {
                iAdFrameworkEnabled = testOptions[AdTraceUtils.KeyTestOptionsiAdFrameworkEnabled].ToLower() == "true";
            }

            _AdTraceSetTestOptions(
                baseUrl,
                basePath,
                gdprUrl,
                gdprPath,
                timerIntervalMilis,
                timerStartMilis,
                sessionIntMilis,
                subsessionIntMilis,
                AdTraceUtils.ConvertBool(teardown),
                AdTraceUtils.ConvertBool(deleteState),
                AdTraceUtils.ConvertBool(noBackoffWait),
                AdTraceUtils.ConvertBool(iAdFrameworkEnabled));
        }
예제 #12
0
 public static void SetOfflineMode(bool enabled)
 {
     _AdTraceSetOfflineMode(AdTraceUtils.ConvertBool(enabled));
 }
예제 #13
0
 public static void SetEnabled(bool enabled)
 {
     _AdTraceSetEnabled(AdTraceUtils.ConvertBool(enabled));
 }
예제 #14
0
 public string GetJsonResponse()
 {
     return(AdTraceUtils.GetJsonResponseCompact(JsonResponse));
 }