Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            btnStart.TouchUpInside += delegate {
                MobileAppTracker.InitTracker(MAT_ADVERTISER_ID, MAT_CONVERSION_KEY);
                MobileAppTracker.SetPackageName(MAT_PACKAGE_NAME);
                MobileAppTracker.SetAppleAdvertisingIdentifier(ASIdentifierManager.SharedManager.AdvertisingIdentifier, ASIdentifierManager.SharedManager.IsAdvertisingTrackingEnabled);

                MobileAppTracker.CheckForDeferredDeeplinkWithTimeout(0.75); // 0.75 sec

                MobileAppTracker.SetFacebookEventLogging(true, false);

                Console.WriteLine("MAT Tracker Started : adv id = {0}, conv key = {1}, package name = {2}", MAT_ADVERTISER_ID, MAT_CONVERSION_KEY, MAT_PACKAGE_NAME);
            };

            btnDelegate.TouchUpInside += delegate {
                Console.WriteLine("matDelegate = " + matDelegate);
                MobileAppTracker.SetDelegate(matDelegate);
            };

            btnDebug.TouchUpInside += delegate {
                MobileAppTracker.SetDebugMode(true);
            };

            btnAllowDup.TouchUpInside += delegate {
                MobileAppTracker.SetAllowDuplicates(true);
            };

            btnSession.TouchUpInside += delegate {
                MobileAppTracker.MeasureSession();
            };

            btnAction.TouchUpInside += delegate {
                MobileAppTracker.MeasureAction("eventAction1");
                MobileAppTracker.MeasureAction("eventAction2", "ref1");
                MobileAppTracker.MeasureAction("eventAction3", "ref2", 1.99f, "GBP");

                MobileAppTracker.MeasureAction(932851438);
                MobileAppTracker.MeasureAction(932851438, "ref3");
                MobileAppTracker.MeasureAction(932851438, "ref4", 1.99f, "GBP");
            };

            btnActionWithItems.TouchUpInside += delegate {
                MATEventItem item1 = MATEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "1", "2", "3", "4", "5");
                MATEventItem item2 = MATEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);

                MobileAppTracker.MeasureAction("eventItems", new MATEventItem[] { item1, item2 });
                MobileAppTracker.MeasureAction("eventItems", new MATEventItem[] { item1, item2 }, "ref5");
                MobileAppTracker.MeasureAction("eventItems", new MATEventItem[] { item1, item2 }, "ref6", 0.89f, "CAD", 0);

                MobileAppTracker.MeasureAction(932851438, new MATEventItem[] { item1, item2 });
                MobileAppTracker.MeasureAction(932851438, new MATEventItem[] { item1, item2 }, "ref7");
                MobileAppTracker.MeasureAction(932851438, new MATEventItem[] { item1, item2 }, "ref8", 0.89f, "CAD", 0);
            };

            btnActionWithReceipt.TouchUpInside += delegate {
                MATEventItem item1 = MATEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "6", "7", "8", "9", "10");
                MATEventItem item2 = MATEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);

                MobileAppTracker.MeasureAction("eventReceipt", new MATEventItem[] { item1, item2 }, "ref9", 132.6f, "RUB", 0, NSData.FromString(GetSampleiTunesIAPReceipt()));

                MobileAppTracker.MeasureAction(932851438, new MATEventItem[] { item1, item2 }, "ref10", 132.6f, "RUB", 0, NSData.FromString(GetSampleiTunesIAPReceipt()));
            };

            btnSetterMethods.TouchUpInside += delegate {
                Console.WriteLine("MAT setter methods");

                MobileAppTracker.SetTRUSTeId("tempTrusteTPID");
                MobileAppTracker.SetUserId("tempUserId");
                MobileAppTracker.SetUserEmail("*****@*****.**");
                MobileAppTracker.SetUserName("tempUserName");
                MobileAppTracker.SetCurrencyCode("GBP");
                MobileAppTracker.SetGender(1);
                MobileAppTracker.SetLocation(1.1, 2.2);
                MobileAppTracker.SetLocationWithAltitude(3.3, 4.4, 5.5);
                MobileAppTracker.SetUseCookieTracking(false);
                MobileAppTracker.SetUseCookieTracking(false);
                MobileAppTracker.SetAppAdTracking(true);
                MobileAppTracker.SetAge(23);
                MobileAppTracker.SetJailbroken(false);
                MobileAppTracker.SetAppleAdvertisingIdentifier(ASIdentifierManager.SharedManager.AdvertisingIdentifier, ASIdentifierManager.SharedManager.IsAdvertisingTrackingEnabled);
                MobileAppTracker.SetAppleVendorIdentifier(new NSUuid("12345678-1234-1234-1234-123456789012"));
                MobileAppTracker.SetFacebookUserId("tempFacebookId");
                MobileAppTracker.SetGoogleUserId("tempGoogleId");
                MobileAppTracker.SetTwitterUserId("tempTwitterId");

                MobileAppTracker.SetEventAttribute1("attr1");
                MobileAppTracker.SetEventAttribute2("attr2");
                MobileAppTracker.SetEventAttribute3("attr3");
                MobileAppTracker.SetEventAttribute4("attr4");
                MobileAppTracker.SetEventAttribute5("attr5");

                MobileAppTracker.SetEventContentType("testContentType");
                MobileAppTracker.SetEventContentId("testContentId");
                MobileAppTracker.SetEventDate1(NSDate.Now);
                MobileAppTracker.SetEventDate2(NSDate.Now.AddSeconds(60));
                MobileAppTracker.SetEventLevel(3);
                MobileAppTracker.SetEventQuantity(2);
                MobileAppTracker.SetEventRating(4.5f);
                MobileAppTracker.SetEventSearchString("testSearchString");

                MobileAppTracker.SetExistingUser(false);
                MobileAppTracker.SetFacebookEventLogging(true, false);
                MobileAppTracker.SetPayingUser(false);
            };

            btnGetterMethods.TouchUpInside += delegate {
                Console.WriteLine("MatId        = " + MobileAppTracker.MatId);
                Console.WriteLine("OpenLogId    = " + MobileAppTracker.OpenLogId);
                Console.WriteLine("IsPayingUser = " + MobileAppTracker.IsPayingUser);
            };
        }