private Amazon.MobileAnalytics.Model.Event BuildSessionEndEvent(string sessionID)
        {
            Amazon.MobileAnalytics.Model.Event sessionEndEvent = new Amazon.MobileAnalytics.Model.Event();

            sessionEndEvent.EventType = "_session.stop";
            //CultureInfo provider = CultureInfo.InvariantCulture;

            Amazon.MobileAnalytics.Model.Session session = new Amazon.MobileAnalytics.Model.Session();
            session.Id              = sessionID;
            session.StartTimestamp  = DateTime.UtcNow;
            session.StopTimestamp   = DateTime.UtcNow;
            session.Duration        = (long)TimeSpan.FromSeconds(20).TotalMilliseconds;
            sessionEndEvent.Session = session;

            Dictionary <string, string> attributes = new Dictionary <string, string>();

            sessionEndEvent.Attributes = attributes;

            Dictionary <string, double> metrics = new Dictionary <string, double>();

            sessionEndEvent.Metrics = metrics;

            sessionEndEvent.Version   = "v2.0";
            sessionEndEvent.Timestamp = DateTime.UtcNow;

            return(sessionEndEvent);
        }
        private Amazon.MobileAnalytics.Model.Event BuildMonetizationEvent()
        {
            Amazon.MobileAnalytics.Model.Event monetizationEvent = new Amazon.MobileAnalytics.Model.Event();

            monetizationEvent.EventType = "_monetization.purchase";
            Amazon.MobileAnalytics.Model.Session session = new Amazon.MobileAnalytics.Model.Session();
            session.Id                = Guid.NewGuid().ToString();
            session.StartTimestamp    = DateTime.UtcNow;
            monetizationEvent.Session = session;

            Dictionary <string, string> attributes = new Dictionary <string, string>();

            attributes.Add("_currency_", "USD");
            attributes.Add("_product_id", "Kindle");
            monetizationEvent.Attributes = attributes;

            Dictionary <string, double> metrics = new Dictionary <string, double>();

            metrics.Add("_quantity", 2);
            metrics.Add("_item_price", 110.0);
            monetizationEvent.Metrics = metrics;

            monetizationEvent.Version   = "v2.0";
            monetizationEvent.Timestamp = DateTime.Now.ToUniversalTime();

            return(monetizationEvent);
        }
        private Amazon.MobileAnalytics.Model.Event BuildSessionStartEvent(string sessionID)
        {
            Amazon.MobileAnalytics.Model.Event sessionStartEvent = new Amazon.MobileAnalytics.Model.Event();

            sessionStartEvent.EventType = "_session.start";
            //CultureInfo provider = CultureInfo.InvariantCulture;

            Amazon.MobileAnalytics.Model.Session session = new Amazon.MobileAnalytics.Model.Session();
            session.Id                = sessionID;
            session.StartTimestamp    = DateTime.UtcNow;
            sessionStartEvent.Session = session;

            Dictionary <string, string> attributes = new Dictionary <string, string>();

            sessionStartEvent.Attributes = attributes;

            Dictionary <string, double> metrics = new Dictionary <string, double>();

            sessionStartEvent.Metrics = metrics;

            sessionStartEvent.Version   = "v2.0";
            sessionStartEvent.Timestamp = DateTime.UtcNow;

            return(sessionStartEvent);
        }
        private Amazon.MobileAnalytics.Model.Event BuildCustomEvent()
        {
            Amazon.MobileAnalytics.Model.Event customEvent = new Amazon.MobileAnalytics.Model.Event();

            customEvent.EventType = "LevelComplete";

            Amazon.MobileAnalytics.Model.Session session = new Amazon.MobileAnalytics.Model.Session();
            session.Id             = Guid.NewGuid().ToString();
            session.StartTimestamp = DateTime.UtcNow;
            session.StopTimestamp  = DateTime.UtcNow;
            session.Duration       = (long)TimeSpan.FromMinutes(30).TotalMilliseconds;
            customEvent.Session    = session;

            Dictionary <string, string> attributes = new Dictionary <string, string>();

            attributes.Add("LevelName", "Level1");
            attributes.Add("CharacterClass", "Warrior");
            attributes.Add("Successful", "True");
            customEvent.Attributes = attributes;

            Dictionary <string, double> metrics = new Dictionary <string, double>();

            metrics.Add("Score", 12345);
            metrics.Add("TimeInLevel", 64);
            customEvent.Metrics = metrics;

            customEvent.Version   = "v2.0";
            customEvent.Timestamp = DateTime.UtcNow;

            return(customEvent);
        }