コード例 #1
0
        public void SmokeTest()
        {
            Localytics.CustomerId = "XamarinFormIOS CustomerId";
            Localytics.SetProfileAttribute((NSString)("Age"), "83", LLProfileScope.Organization);

            Localytics.AddProfileAttributesToSet(new NSObject[] { (NSNumber)(222), (NSString)("333") }, "Lucky numbers", LLProfileScope.Application);

            Localytics.DeleteProfileAttribute("TestDeleteProfileAttribute", LLProfileScope.Application);

            Localytics.SetCustomerEmail("XamarinFormIOS Email");
            Localytics.SetCustomerFirstName("XamarinFormIOS FirstName");
            Localytics.SetCustomerLastName("XamarinFormIOS LastName");
            Localytics.SetCustomerFullName("XamarinFormIOS Full Name");

            Localytics.SetCustomDimension("XamarinFormIOSCD1", 1);

            Localytics.TagEvent("XamarinFormIOS Start");
            Localytics.TagScreen("XamarinFormIOS Landing");

            Localytics.Upload();


            // Run through some Interface function
            this.AddProfileAttributesToSet(new object[] { 234, 345 }, "Android Interface Lucky Number", XFLLProfileScope.Application);
        }
コード例 #2
0
        private void SmokeTest()
        {
            Localytics.CustomerId = "XamarinIOSClassic CustomerId";
            Localytics.SetProfileAttribute((NSString)("IOSClassic Age"), "83", LLProfileScope.Organization);

            Localytics.AddProfileAttributesToSet(new NSObject[] { (NSNumber)(222), (NSString)("333") }, "IOSClassic numbers", LLProfileScope.Application);

            Localytics.DeleteProfileAttribute("TestDeleteProfileAttribute", LLProfileScope.Application);

            Localytics.SetCustomerEmail("XamarinIOSClassic Email");
            Localytics.SetCustomerFirstName("XamarinIOSClassic FirstName");
            Localytics.SetCustomerLastName("XamarinIOSClassic LastName");
            Localytics.SetCustomerFullName("XamarinIOSClassic Full Name");

            Localytics.SetCustomDimension("XamarinFormIOSCD1", 1);

            Localytics.TagEvent("XamarinIOSClassic Start");
            Localytics.TagScreen("XamarinIOSClassic Landing");

            Localytics.Upload();
        }
        public void SmokeTest()
        {
            Localytics.CustomerId = "XamarinFormAndroid CustomerId";
            Localytics.SetProfileAttribute("Age", 83, Localytics.ProfileScope.Organization);

            Localytics.AddProfileAttributesToSet("Android Lucky Number", new long[] { 321, 654 }, Localytics.ProfileScope.Application);

            Localytics.DeleteProfileAttribute("TestDeleteProfileAttribute", Localytics.ProfileScope.Application);

            Localytics.SetCustomerEmail("XamarinFormAndroid Email");
            Localytics.SetCustomerFirstName("XamarinFormAndroid FirstName");
            Localytics.SetCustomerLastName("XamarinFormAndroid LastName");
            Localytics.SetCustomerFullName("XamarinFormAndroid Full Name");

            Localytics.SetCustomDimension(1, "XamarinFormAndroidCD1");

            Localytics.TagEvent("XamarinFormAndroid Start");
            Localytics.TagScreen("XamarinFormAndroid Landing");
            Localytics.Upload();

            // Run through some Interface function
            this.AddProfileAttributesToSet(new object[] { 234, 345 }, "Android Interface Lucky Number", XFLLProfileScope.Application);
        }
コード例 #4
0
 public void Upload()
 {
     Localytics.Upload();
 }
コード例 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);
            LocalyticsAutoIntegrateApplication.localyticsXamarin.CustomerId = "ms_test_user";

            // Register Push
            Localytics.RegisterPush();                  //"YOUR_GCM_PROJECT_NUMBER");
            Localytics.SetOption("session_timeout", 1); // Shorten for testing purpose only

            Button tagEventButton = FindViewById <Button>(Resource.Id.tagEventButton);

            tagEventButton.Click += delegate
            {
                LocalyticsAutoIntegrateApplication.localyticsXamarin.TagEvent("MessagingSample Click");
                Localytics.Upload();
            };

            Button showRegistrationIdButton = FindViewById <Button>(Resource.Id.showRegistrationId);

            showRegistrationIdButton.Click += delegate
            {
                // Blocking Getters may need to be threaded out
                ThreadPool.QueueUserWorkItem(delegate
                {
                    TextView pushText = FindViewById <TextView>(Resource.Id.pushText);
                    string pushRegId  = Localytics.PushRegistrationId;

                    // Update UI back on UI Thread
                    RunOnUiThread(() =>
                    {
                        pushText.Text = pushRegId;
                    });
                });
            };

            Button openInboxButton = FindViewById <Button>(Resource.Id.openInbox);

            openInboxButton.Click += delegate
            {
                StartActivity(typeof(InboxActivity));
            };

            Button startPlacesButton = FindViewById <Button>(Resource.Id.startPlaces);

            startPlacesButton.Click += delegate
            {
                if ((int)Build.VERSION.SdkInt < 23)
                {
                    Localytics.SetLocationMonitoringEnabled(true);
                }
                else
                {
                    const string permission = Manifest.Permission.AccessFineLocation;
                    if (ActivityCompat.CheckSelfPermission(this, permission) == (int)Permission.Granted)
                    {
                        Localytics.SetLocationMonitoringEnabled(true);
                    }
                    else
                    {
                        ActivityCompat.RequestPermissions(this, PermissionsLocation, RequestLocationId);
                    }
                }
            };
        }
コード例 #6
0
 protected override void Initialize()
 {
     _localytics.Open();
     _localytics.Upload();
 }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        Localytics.LoggingEnabled = true;

        Localytics.RegisterForAnalyticsEvents();
        Localytics.RegisterForMessagingEvents();

        // This is just for testing purpose
        Localytics.UnregisterForAnalyticsEvents();
        Localytics.UnregisterForMessagingEvents();

        Localytics.RegisterForAnalyticsEvents();
        Localytics.RegisterForMessagingEvents();

        //Localytics.TestModeEnabled = true;
        Localytics.OnLocalyticsDidTagEvent      += Localytics_OnLocalyticsDidTagEvent;
        Localytics.OnLocalyticsSessionWillOpen  += Localytics_OnLocalyticsSessionWillOpen;
        Localytics.OnLocalyticsSessionDidOpen   += Localytics_OnLocalyticsSessionDidOpen;
        Localytics.OnLocalyticsSessionWillClose += Localytics_OnLocalyticsSessionWillClose;

        Localytics.OnLocalyticsDidDismissInAppMessage  += Localytics_OnLocalyticsDidDismissInAppMessage;
        Localytics.OnLocalyticsDidDisplayInAppMessage  += Localytics_OnLocalyticsDidDisplayInAppMessage;
        Localytics.OnLocalyticsWillDismissInAppMessage += Localytics_OnLocalyticsWillDismissInAppMessage;
        Localytics.OnLocalyticsWillDisplayInAppMessage += Localytics_OnLocalyticsWillDisplayInAppMessage;
        Localytics.SessionTimeoutInterval = 15;

        _openSession.onClick.AddListener(() => { Localytics.OpenSession(); Localytics.Upload(); });
        _closeSession.onClick.AddListener(() => { Localytics.CloseSession(); Localytics.Upload(); });
        _tagEventClick.onClick.AddListener(() => { Localytics.TagEvent("click"); Localytics.Upload(); });
        _tagScreen1.onClick.AddListener(() => { Localytics.TagScreen("screen1"); Localytics.Upload(); });
        _tagScreen2.onClick.AddListener(() => { Localytics.TagScreen("screen2"); Localytics.Upload(); });

        Localytics.CustomerId = "user1";

        Localytics.SetIdentifier("test_identifier", "test setIdentifier");
        Localytics.GetIdentifier("test_identifier");

        Localytics.InAppMessageDismissButtonLocationEnum = Localytics.InAppMessageDismissButtonLocation.Right;

        Localytics.TriggerInAppMessage("Sample Startup", null);

        // to set a profile attribute:
        Localytics.SetProfileAttribute("Age", 45, Localytics.ProfileScope.Organization);
        Localytics.SetProfileAttribute("Lucky numbers", new long[] { 8, 13 }, Localytics.ProfileScope.Application);
        Localytics.SetProfileAttribute("Hometown", "New York, New York", Localytics.ProfileScope.Organization);
        Localytics.SetProfileAttribute("States visited", new String[] { "New York", "California", "South Dakota" }, Localytics.ProfileScope.Application);

        // to remove a profile attribute:
        Localytics.DeleteProfileAttribute("Days until graduation", Localytics.ProfileScope.Application);

        // to add a set of values to an already-defined set of values:
        Localytics.AddProfileAttributesToSet("Lucky numbers", new long[] { 666 }, Localytics.ProfileScope.Application);
        Localytics.AddProfileAttributesToSet("States visited", new String[] { "North Dakota" }, Localytics.ProfileScope.Application);

        // to remove a set of values from an already-defined set of values:
        Localytics.RemoveProfileAttributesFromSet("Lucky numbers", new long[] { 8, 666 }, Localytics.ProfileScope.Application);
        Localytics.RemoveProfileAttributesFromSet("States visited", new String[] { "California" }, Localytics.ProfileScope.Application);

        // to increment or decrement an already-defined value:
        Localytics.IncrementProfileAttribute("Age", 1, Localytics.ProfileScope.Organization);
        Localytics.DecrementProfileAttribute("Days until graduation", 3, Localytics.ProfileScope.Application);

        Localytics.SetCustomerEmail("Convenient Email");
        Localytics.SetCustomerFirstName("Convenient FirstName");
        Localytics.SetCustomerLastName("Convenient LastName");
        Localytics.SetCustomerFullName("Convenient Full Name");

        Localytics.SetCustomDimension(1, "testCD1");
        Localytics.GetCustomDimension(1);

        Localytics.Upload();

        Input.location.Start();
        _lastStatus = Input.location.status;

        UpdateLabels();
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        Localytics.LoggingEnabled = true;

        Localytics.RegisterForAnalyticsEvents();
        Localytics.RegisterForMessagingEvents();
        Localytics.RegisterForLocationEvents();

        // This is just for testing purpose
        Localytics.UnregisterForAnalyticsEvents();
        Localytics.UnregisterForMessagingEvents();
        Localytics.UnregisterForLocationEvents();

        Localytics.RegisterForAnalyticsEvents();
        Localytics.RegisterForMessagingEvents();
        Localytics.RegisterForLocationEvents();

        // Analytics events
        Localytics.OnLocalyticsDidTagEvent      += Localytics_OnLocalyticsDidTagEvent;
        Localytics.OnLocalyticsSessionWillOpen  += Localytics_OnLocalyticsSessionWillOpen;
        Localytics.OnLocalyticsSessionDidOpen   += Localytics_OnLocalyticsSessionDidOpen;
        Localytics.OnLocalyticsSessionWillClose += Localytics_OnLocalyticsSessionWillClose;

        // Messaging events
        Localytics.OnLocalyticsDidDismissInAppMessage  += Localytics_OnLocalyticsDidDismissInAppMessage;
        Localytics.OnLocalyticsDidDisplayInAppMessage  += Localytics_OnLocalyticsDidDisplayInAppMessage;
        Localytics.OnLocalyticsWillDismissInAppMessage += Localytics_OnLocalyticsWillDismissInAppMessage;
        Localytics.OnLocalyticsWillDisplayInAppMessage += Localytics_OnLocalyticsWillDisplayInAppMessage;
#if UNITY_ANDROID
        Localytics.OnLocalyticsShouldShowPushNotification       += Localytics_OnLocalyticsShouldShowPushNotification;
        Localytics.OnLocalyticsShouldShowPlacesPushNotification += Localytics_OnLocalyticsShouldShowPlacesPushNotification;
        Localytics.OnLocalyticsWillShowPushNotification         += Localytics_OnLocalyticsWillShowPushNotification;
        Localytics.OnLocalyticsWillShowPlacesPushNotification   += Localytics_OnLocalyticsWillShowPlacesPushNotification;
#endif

        // Location events
        Localytics.OnLocalyticsDidUpdateLocation           += Localytics_OnLocalyticsDidUpdateLocation;
        Localytics.OnLocalyticsDidTriggerRegions           += Localytics_OnLocalyticsDidTriggerRegions;
        Localytics.OnLocalyticsDidUpdateMonitoredGeofences += Localytics_OnLocalyticsDidUpdateMonitoredGeofences;

        _openSession.onClick.AddListener(() => {
            Localytics.OpenSession();
            Localytics.Upload();
        });
        _closeSession.onClick.AddListener(() => {
            Localytics.CloseSession();
            Localytics.Upload();
        });
        _tagEventClick.onClick.AddListener(() => {
            Dictionary <string, string> attributes = new Dictionary <string, string> ();
            attributes.Add("attr", "value");
            Localytics.TagEvent("test", attributes);
            CustomerInfo customer = new CustomerInfo();
            customer.CustomerId   = "1vl83nshl";
            customer.FirstName    = "John";
            customer.LastName     = "Doe";
            customer.FullName     = "John Michael Doe";
            customer.EmailAddress = "*****@*****.**";
            Localytics.TagCustomerRegistered(customer, "native", attributes);              // events to follow have John Doe customer ID
            Localytics.TagPurchased("phone", "2jk87bv", "electronics", 500, attributes);
            Localytics.TagAddedToCart("phone", "2jk87bv", "electronics", 500, attributes);
            Localytics.TagStartedCheckout(600, 2, attributes);
            Localytics.TagCustomerLoggedOut(attributes);              // events to following back to anonymous customer ID
            Localytics.TagCompletedCheckout(700, 3, attributes);
            Localytics.TagContentViewed("product review", "91lkjlad5", "video", attributes);
            Localytics.TagSearched("best phone", "electronics", 125, attributes);
            customer              = new CustomerInfo();
            customer.CustomerId   = "96dba36ak";
            customer.FirstName    = "Jane";
            customer.LastName     = "Doe";
            customer.FullName     = "Jane Sarah Doe";
            customer.EmailAddress = "*****@*****.**";
            Localytics.TagCustomerLoggedIn(customer, "facebook", attributes);              // events to follow have Jane Doe customer ID
            Localytics.TagShared("9 awesome things", "91hha3zx", "article", "twitter", attributes);
            Localytics.TagContentRated("delicious apps", "10fk38vh", "food", 4, attributes);
            Localytics.TagInvited("sms", attributes);
            Localytics.Upload();
        });
        _tagScreen1.onClick.AddListener(() => {
            Localytics.TagScreen("screen1");
            Localytics.Upload();
        });

        _tagScreen2.onClick.AddListener(() => {
            Localytics.TagScreen("screen2");
            Localytics.Upload();
        });

        _enableTestMode.onClick.AddListener(() => {
            Localytics.TestModeEnabled = true;
            UpdateLabels();
        });

        _testPlaces.onClick.AddListener(() => {
            List <CircularRegionInfo> toMonitor = Localytics.GetGeofencesToMonitor(42.34952, -71.05017);
            Debug.Log("Geofences to monitor:");
            foreach (CircularRegionInfo info in toMonitor)
            {
                printCircularRegion(info);
            }

            CircularRegionInfo regionInfo       = new CircularRegionInfo();
            regionInfo.UniqueId                 = "2nla29ahd"; // only the unique ID is required when manually triggering
            List <CircularRegionInfo> toTrigger = new List <CircularRegionInfo> ();
            toTrigger.Add(regionInfo);
            Localytics.TriggerRegions(toTrigger, Localytics.RegionEvent.Enter);

            // For iOS, complete PLIST, notification registration, and UserNotification (if relevant) steps before
            // enabling location monitoring. For Android, complete AnddroidManifest.xml additions and add runtime permission
            // ask before enabling location monitoring.
            // See http://docs.localytics.com/dev/ios.html#places-ios and http://docs.localytics.com/dev/android.html#places-android
            //Localytics.LocationMonitoringEnabled = true;
        });

        Localytics.CustomerId = "user1";
        Debug.Log("customer ID: " + Localytics.CustomerId);

        Localytics.SetIdentifier("test_identifier", "test setIdentifier");
        Debug.Log("identifier: " + Localytics.GetIdentifier("test_identifier"));

        Localytics.InAppMessageDismissButtonLocationEnum = Localytics.InAppMessageDismissButtonLocation.Right;

        Localytics.TriggerInAppMessage("Sample Startup", null);

        // to set a profile attribute:
        Localytics.SetProfileAttribute("Age", 45, Localytics.ProfileScope.Organization);
        Localytics.SetProfileAttribute("Lucky numbers", new long[] { 8, 13 }, Localytics.ProfileScope.Application);
        Localytics.SetProfileAttribute("Hometown", "New York, New York", Localytics.ProfileScope.Organization);
        Localytics.SetProfileAttribute("States visited", new String[] { "New York", "California", "South Dakota" }, Localytics.ProfileScope.Application);

        // to remove a profile attribute:
        Localytics.DeleteProfileAttribute("Days until graduation", Localytics.ProfileScope.Application);

        // to add a set of values to an already-defined set of values:
        Localytics.AddProfileAttributesToSet("Lucky numbers", new long[] { 666 }, Localytics.ProfileScope.Application);
        Localytics.AddProfileAttributesToSet("States visited", new String[] { "North Dakota" }, Localytics.ProfileScope.Application);

        // to remove a set of values from an already-defined set of values:
        Localytics.RemoveProfileAttributesFromSet("Lucky numbers", new long[] { 8, 666 }, Localytics.ProfileScope.Application);
        Localytics.RemoveProfileAttributesFromSet("States visited", new String[] { "California" }, Localytics.ProfileScope.Application);

        // to increment or decrement an already-defined value:
        Localytics.IncrementProfileAttribute("Age", 1, Localytics.ProfileScope.Organization);
        Localytics.DecrementProfileAttribute("Days until graduation", 3, Localytics.ProfileScope.Application);

        Localytics.SetCustomerEmail("Convenient Email");
        Localytics.SetCustomerFirstName("Convenient FirstName");
        Localytics.SetCustomerLastName("Convenient LastName");
        Localytics.SetCustomerFullName("Convenient Full Name");

        Localytics.SetCustomDimension(1, "testCD1");
        Debug.Log("test CD: " + Localytics.GetCustomDimension(1));

        Localytics.Upload();

        Input.location.Start();
        _lastStatus = Input.location.status;

        UpdateLabels();
    }