partial void UIButton6_TouchUpInside(UIButton sender)
        {
            // Monetization Event Button Handler
            MonetizationEvent monetizationEvent = new MonetizationEvent();

            monetizationEvent.Quantity = 10.0;
            monetizationEvent.ItemPrice = 2.00;
            monetizationEvent.ProductId = "ProductId123";
            monetizationEvent.ItemPriceFormatted = "$2.00";
            monetizationEvent.Store = "Apple";
            monetizationEvent.TransactionId = "TransactionId123";
            monetizationEvent.Currency = "USD";

            Manager.RecordEvent(monetizationEvent);
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button customEventButton = FindViewById<Button>(Resource.Id.button_custom_event);
            Button monetizationEventButton = FindViewById<Button>(Resource.Id.button_monetization_event);


            customEventButton.Click += delegate
            {
                CustomEvent customEvent = new CustomEvent("level_complete");

                customEvent.AddAttribute("LevelName", "Level5");
                customEvent.AddAttribute("Successful", "True");
                customEvent.AddMetric("Score", 12345);
                customEvent.AddMetric("TimeInLevel", 64);

                _manager.RecordEvent(customEvent);
            };


            monetizationEventButton.Click += delegate
            {
                MonetizationEvent monetizationEvent = new MonetizationEvent();

                monetizationEvent.Quantity = 10.0;
                monetizationEvent.ItemPrice = 2.00;
                monetizationEvent.ProductId = "ProductId123";
                monetizationEvent.ItemPriceFormatted = "$2.00";
                monetizationEvent.Store = "Amazon";
                monetizationEvent.TransactionId = "TransactionId123";
                monetizationEvent.Currency = "USD";

                _manager.RecordEvent(monetizationEvent);
            };


            // customize your Mobile Analytics Manager Config
            MobileAnalyticsManagerConfig config = new MobileAnalyticsManagerConfig();
            config.AllowUseDataNetwork = true;

            _manager = MobileAnalyticsManager.GetOrCreateInstance(APP_ID, new CognitoAWSCredentials(COGNITO_POOL_ID, COGNITO_REGION), RegionEndpoint.USEast1, config);
        }
        void OnGUI()
        {
            GUILayout.BeginArea(new Rect(0, 0, Screen.width * 0.5f, Screen.height));
            GUILayout.Label("Amazon Mobile Analytics Operations");

            // record custom event
            if (GUILayout.Button("Record Custom Event", GUILayout.MinHeight(Screen.height * 0.2f), GUILayout.Width(Screen.width * 0.4f)))
            {
                CustomEvent customEvent = new CustomEvent("level_complete");

                customEvent.AddAttribute("LevelName", "Level1");
                customEvent.AddAttribute("CharacterClass", "Warrior");
                customEvent.AddAttribute("Successful", "True");
                customEvent.AddMetric("Score", 12345);
                customEvent.AddMetric("TimeInLevel", 64);

                analyticsManager.RecordEvent(customEvent);
            }

            // record monetization event
            if (GUILayout.Button("Record Monetization Event", GUILayout.MinHeight(Screen.height * 0.2f), GUILayout.Width(Screen.width * 0.4f)))
            {
                MonetizationEvent monetizationEvent = new MonetizationEvent();

                monetizationEvent.Quantity = 3.0;
                monetizationEvent.ItemPrice = 1.99;
                monetizationEvent.ProductId = "ProductId123";
                monetizationEvent.ItemPriceFormatted = "$1.99";
                monetizationEvent.Store = "Apple";
                monetizationEvent.TransactionId = "TransactionId123";
                monetizationEvent.Currency = "USD";

                analyticsManager.RecordEvent(monetizationEvent);
            }


            GUILayout.EndArea();

        }