protected override bool AppLaunchedProvider(bool firstTime, int count)
        {
            // Prepare the values
            Value value = new Value();

            value["First Time"] = firstTime;
            value["Count"]      = count;

            Mixpanel.Track("App Launched", value);

            // Send the data immediately
            Mixpanel.FlushQueue();

            return(true);
        }
Пример #2
0
    void Start()
    {
        tokenSent = false;
        #if UNITY_IOS && UNITY_5_0_0
        UnityEngine.iOS.NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);
        #endif

        // track a transaction of 42 US cents
        Mixpanel.people.TrackCharge(0.42);

        // track an event
        Mixpanel.Track("Hello From Unity1");

        var args = new Value();
        args["level"]  = 84;
        args["coins"]  = 99;
        args["health"] = 83.2f;
        args["bar"]["nested"]["value"] = 20.0; // you can easily create nested objects
        args["unicode"] = "€öäüß✓✓✓✓";         // you can also use unicode strings

        Mixpanel.Track("event with parameters", args);

        Mixpanel.people.Set("gender", "male");

        Mixpanel.StartTimedEvent("time_it");
        // do some lengthy task here
        Mixpanel.Track("time_it");

        // there are also shorthand functions for the special mixpanel properties:
        Mixpanel.people.Name  = "Tilo Tester2";
        Mixpanel.people.Email = "*****@*****.**";

        // you can manually trigger the flushing of the queue.
        Mixpanel.FlushQueue();
    }