示例#1
0
        public override void Dump(RudderMessage message)
        {
            RudderLogger.LogDebug("Adjust integration dump event: " + message.eventName);
            if (message.eventName != null && this.eventTokenMap.ContainsKey(message.eventName))
            {
                string eventToken = this.eventTokenMap[message.eventName];
                RudderLogger.LogDebug("Adjust integration dump: eventToken: " + eventToken);
                if (eventToken != null && !eventToken.Equals(""))
                {
                    this.AddSessionParameter(RudderCache.GetAnonymousId());

                    RudderLogger.LogDebug("Creating Adjust event");
                    AdjustEvent adjustEvent = new AdjustEvent(eventToken);

                    RudderLogger.LogDebug("Adding Event Properties");
                    Dictionary <string, object> eventProperties = message.eventProperties;
                    if (eventProperties != null)
                    {
                        foreach (string key in eventProperties.Keys)
                        {
                            adjustEvent.addCallbackParameter(key, eventProperties[key].ToString());
                        }
                    }

                    RudderLogger.LogDebug("Adding User Properties");
                    Dictionary <string, object> userProperties = message.userProperties;
                    if (userProperties != null)
                    {
                        foreach (string key in userProperties.Keys)
                        {
                            adjustEvent.addCallbackParameter(key, userProperties[key].ToString());
                        }
                    }

                    RudderLogger.LogDebug("Tracking revenue through Adjust SDK");
                    if (message.eventProperties.ContainsKey("revenue"))
                    {
                        double amount   = (double)message.eventProperties["revenue"];
                        string currency = "";
                        if (message.eventProperties.ContainsKey("currency"))
                        {
                            currency = message.eventProperties["currency"] as string;
                        }
                        adjustEvent.setRevenue(amount, currency);
                    }

                    RudderLogger.LogDebug("Tracking event");
                    Adjust.trackEvent(adjustEvent);
                }
                else
                {
                    RudderLogger.LogDebug("Incorrect event token for Adjust");
                }
            }
            else
            {
                RudderLogger.LogDebug("RudderAdjustIntegration: Event is not tracked through Adjust");
            }
        }
示例#2
0
    public void CustomEventCallback(string eventId, Dictionary <string, string> dic)
    {
        AdjustEvent adjustEvent = new AdjustEvent(eventId);

        List <string> paramKey = new List <string>(dic.Keys);

        for (int i = 0; i < paramKey.Count; i++)
        {
            adjustEvent.addCallbackParameter(paramKey[i], dic[paramKey[i]]);
        }
        Adjust.trackEvent(adjustEvent);
        paramKey.Clear();
    }
    public void TrackEventGDPR(Dictionary <string, bool> agreements)
    {
        if (this.adjust == null || agreements == null || 0 >= agreements.Count)
        {
            global::Debug.Log(this.errorMessage);
            return;
        }
        AdjustEvent adjustEvent = new AdjustEvent(AdjustWrapper.EVENT_ID_CONFIRM_GDPR);

        foreach (KeyValuePair <string, bool> keyValuePair in agreements)
        {
            string value = (!keyValuePair.Value) ? "0" : "1";
            adjustEvent.addCallbackParameter(keyValuePair.Key, value);
        }
        this.adjust.trackEvent(adjustEvent);
    }
示例#4
0
    public static void LogEvent(string eventName, Dictionary <string, string> dict)
    {
        if (!AdjustHelper.inited)
        {
            return;
        }
        string text = AdjustHelper.EventNameToToken(eventName);

        if (!string.IsNullOrEmpty(text))
        {
            AdjustEvent adjustEvent = new AdjustEvent(text);
            if (dict != null)
            {
                foreach (KeyValuePair <string, string> keyValuePair in dict)
                {
                    adjustEvent.addPartnerParameter(keyValuePair.Key, keyValuePair.Value);
                    adjustEvent.addCallbackParameter(keyValuePair.Key, keyValuePair.Value);
                }
            }
            Adjust.trackEvent(adjustEvent);
        }
    }
示例#5
0
    void OnGUI()
    {
        if (showPopUp)
        {
            GUI.Window(0, new Rect((Screen.width / 2) - 150, (Screen.height / 2) - 65, 300, 130), showGUI, "Is SDK enabled?");
        }

        if (GUI.Button(new Rect(0, Screen.height * 0 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtManualLaunch))
        {
            if (!string.Equals(txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase))
            {
                AdjustConfig adjustConfig = new AdjustConfig("2fm9gkqubvpc", AdjustEnvironment.Sandbox);
                adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
                adjustConfig.setLogDelegate(msg => Debug.Log(msg));
                adjustConfig.setSendInBackground(true);
                adjustConfig.setLaunchDeferredDeeplink(true);

                adjustConfig.setEventSuccessDelegate(EventSuccessCallback);
                adjustConfig.setEventFailureDelegate(EventFailureCallback);
                adjustConfig.setSessionSuccessDelegate(SessionSuccessCallback);
                adjustConfig.setSessionFailureDelegate(SessionFailureCallback);
                adjustConfig.setDeferredDeeplinkDelegate(DeferredDeeplinkCallback);
                adjustConfig.setAttributionChangedDelegate(AttributionChangedCallback);

                Adjust.start(adjustConfig);
                isEnabled = true;

                txtManualLaunch = "SDK Launched";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 1 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Simple Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("g3mfiw");
            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 2 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Revenue Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("a4fd35");
            adjustEvent.setRevenue(0.25, "EUR");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 3 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Callback Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("34vgg9");

            adjustEvent.addCallbackParameter("key", "value");
            adjustEvent.addCallbackParameter("foo", "bar");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 4 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Track Partner Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("w788qs");

            adjustEvent.addPartnerParameter("key", "value");
            adjustEvent.addPartnerParameter("foo", "bar");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 5 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtSetOfflineMode))
        {
            if (string.Equals(txtSetOfflineMode, "Turn Offline Mode ON", StringComparison.OrdinalIgnoreCase))
            {
                Adjust.setOfflineMode(true);
                txtSetOfflineMode = "Turn Offline Mode OFF";
            }
            else
            {
                Adjust.setOfflineMode(false);
                txtSetOfflineMode = "Turn Offline Mode ON";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 6 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), txtSetEnabled))
        {
            if (string.Equals(txtSetEnabled, "Disable SDK", StringComparison.OrdinalIgnoreCase))
            {
                Adjust.setEnabled(false);
                txtSetEnabled = "Enable SDK";
            }
            else
            {
                Adjust.setEnabled(true);
                txtSetEnabled = "Disable SDK";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 7 / numberOfButtons, Screen.width, Screen.height / numberOfButtons), "Is SDK Enabled?"))
        {
            isEnabled = Adjust.isEnabled();
            showPopUp = true;
        }
    }
示例#6
0
    void OnGUI()
    {
        if (showPopUp)
        {
            GUI.Window(0, new Rect((Screen.width / 2) - 150, (Screen.height / 2) - 65, 300, 130), showGUI, "Is SDK enabled?");
        }

        if (GUI.Button(new Rect(0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtManualLaunch))
        {
            if (!string.Equals(txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase))
            {
                AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox);
                adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
                adjustConfig.setAttributionChangedDelegate(this.attributionChangedDelegate);

                Adjust.start(adjustConfig);
                isEnabled = true;

                txtManualLaunch = "SDK Launched";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 1 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Simple Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("{YourEventToken}");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 2 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Revenue Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("{YourEventToken}");
            adjustEvent.setRevenue(0.25, "EUR");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 3 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Callback Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("{YourEventToken}");

            adjustEvent.addCallbackParameter("key", "value");
            adjustEvent.addCallbackParameter("foo", "bar");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 4 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Partner Event"))
        {
            AdjustEvent adjustEvent = new AdjustEvent("{YourEventToken}");

            adjustEvent.addPartnerParameter("key", "value");
            adjustEvent.addPartnerParameter("foo", "bar");

            Adjust.trackEvent(adjustEvent);
        }

        if (GUI.Button(new Rect(0, Screen.height * 5 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtSetOfflineMode))
        {
            if (string.Equals(txtSetOfflineMode, "Turn Offline Mode ON", StringComparison.OrdinalIgnoreCase))
            {
                Adjust.setOfflineMode(true);

                txtSetOfflineMode = "Turn Offline Mode OFF";
            }
            else
            {
                Adjust.setOfflineMode(false);

                txtSetOfflineMode = "Turn Offline Mode ON";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 6 / nr_buttons, Screen.width, Screen.height / nr_buttons), txtSetEnabled))
        {
            if (string.Equals(txtSetEnabled, "Disable SDK", StringComparison.OrdinalIgnoreCase))
            {
                Adjust.setEnabled(false);

                txtSetEnabled = "Enable SDK";
            }
            else
            {
                Adjust.setEnabled(true);

                txtSetEnabled = "Disable SDK";
            }
        }

        if (GUI.Button(new Rect(0, Screen.height * 7 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Is SDK Enabled?"))
        {
            isEnabled = Adjust.isEnabled();

            showPopUp = true;
        }
    }
示例#7
0
 private void OnGUI()
 {
     if (this.showPopUp)
     {
         GUI.Window(0, new Rect((float)(Screen.width / 2 - 150), (float)(Screen.height / 2 - 65), 300f, 130f), new GUI.WindowFunction(this.showGUI), "Is SDK enabled?");
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 0 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), this.txtManualLaunch) && !string.Equals(this.txtManualLaunch, "SDK Launched", StringComparison.OrdinalIgnoreCase))
     {
         AdjustConfig adjustConfig = new AdjustConfig("2fm9gkqubvpc", AdjustEnvironment.Sandbox);
         adjustConfig.setLogLevel(AdjustLogLevel.Verbose);
         adjustConfig.setLogDelegate(delegate(string msg)
         {
             UnityEngine.Debug.Log(msg);
         });
         adjustConfig.setSendInBackground(true);
         adjustConfig.setLaunchDeferredDeeplink(true);
         adjustConfig.setEventSuccessDelegate(new Action <AdjustEventSuccess>(this.EventSuccessCallback), "Adjust");
         adjustConfig.setEventFailureDelegate(new Action <AdjustEventFailure>(this.EventFailureCallback), "Adjust");
         adjustConfig.setSessionSuccessDelegate(new Action <AdjustSessionSuccess>(this.SessionSuccessCallback), "Adjust");
         adjustConfig.setSessionFailureDelegate(new Action <AdjustSessionFailure>(this.SessionFailureCallback), "Adjust");
         adjustConfig.setDeferredDeeplinkDelegate(new Action <string>(this.DeferredDeeplinkCallback), "Adjust");
         adjustConfig.setAttributionChangedDelegate(new Action <AdjustAttribution>(this.AttributionChangedCallback), "Adjust");
         Adjust.start(adjustConfig);
         this.isEnabled       = true;
         this.txtManualLaunch = "SDK Launched";
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), "Track Simple Event"))
     {
         AdjustEvent adjustEvent = new AdjustEvent("g3mfiw");
         Adjust.trackEvent(adjustEvent);
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 2 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), "Track Revenue Event"))
     {
         AdjustEvent adjustEvent2 = new AdjustEvent("a4fd35");
         adjustEvent2.setRevenue(0.25, "EUR");
         Adjust.trackEvent(adjustEvent2);
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 3 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), "Track Callback Event"))
     {
         AdjustEvent adjustEvent3 = new AdjustEvent("34vgg9");
         adjustEvent3.addCallbackParameter("key", "value");
         adjustEvent3.addCallbackParameter("foo", "bar");
         Adjust.trackEvent(adjustEvent3);
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 4 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), "Track Partner Event"))
     {
         AdjustEvent adjustEvent4 = new AdjustEvent("w788qs");
         adjustEvent4.addPartnerParameter("key", "value");
         adjustEvent4.addPartnerParameter("foo", "bar");
         Adjust.trackEvent(adjustEvent4);
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 5 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), this.txtSetOfflineMode))
     {
         if (string.Equals(this.txtSetOfflineMode, "Turn Offline Mode ON", StringComparison.OrdinalIgnoreCase))
         {
             Adjust.setOfflineMode(true);
             this.txtSetOfflineMode = "Turn Offline Mode OFF";
         }
         else
         {
             Adjust.setOfflineMode(false);
             this.txtSetOfflineMode = "Turn Offline Mode ON";
         }
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 6 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), this.txtSetEnabled))
     {
         if (string.Equals(this.txtSetEnabled, "Disable SDK", StringComparison.OrdinalIgnoreCase))
         {
             Adjust.setEnabled(false);
             this.txtSetEnabled = "Enable SDK";
         }
         else
         {
             Adjust.setEnabled(true);
             this.txtSetEnabled = "Disable SDK";
         }
     }
     if (GUI.Button(new Rect(0f, (float)(Screen.height * 7 / this.numberOfButtons), (float)Screen.width, (float)(Screen.height / this.numberOfButtons)), "Is SDK Enabled?"))
     {
         this.isEnabled = Adjust.isEnabled();
         this.showPopUp = true;
     }
 }