public static SendEvent ( string eventName, object>.IDictionary |
||
eventName | string | |
properties | object>.IDictionary | |
return | void |
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { Mixpanel.SendEvent("Completed level " + level); } }
/// <summary> /// Tracks the event with a dictionary of event info. /// </summary> public void TrackEvent(string eventName, Dictionary <string, object> eventInfo) { if (this.Options == null || this.Options.Mode == AnalyticsMode.Disabled) { return; } if (!this.MixpanelInitialized) { // We do not wait for this coroutine to finish because // we want the first event, App Started, to definitely be // the first event sent, and be timed correctly. // The coroutine will begin the process of collecting // the installed apps (incl. downloading the list of apps // to check for), so that info will be available only // on later events. this.StartCoroutine(this.ConfigureMixpanelAsync()); this.MixpanelInitialized = true; } if (this.Native && this.Native.HasMixpanel) { this.Native.MixpanelEvent(eventName, eventInfo); } else { Mixpanel.SendEvent(eventName, eventInfo); } }
public void FakeLogin() { // API APIController.SavePlayer(player.PlayerId, player.Name.Replace(" ", "%20"), player.AccessToken); // HeroicLabs Client.ApiKey = "31c210da7f0b4110bc301544870733d6"; Client.Ping(onError); Client.LoginOAuthFacebook(player.AccessToken, (SessionClient session) => { MPScript.Data.SessionClient = session; MPScript.Data.SessionClient.Gamer((Gamer gamer) => { string nickname = player.Name.Replace(' ', '_'); if (gamer.Nickname != nickname) { MPScript.Data.SessionClient.UpdateGamer(nickname, onSuccess, onError); } }, onError); }, onError); // Mixpanel Mixpanel.DistinctID = player.PlayerId; Mixpanel.SendEvent("DevSkip Login"); }
//tracking overall player progress: sent every time the player loads up crafting public static void Progress() { Mixpanel.SendEvent("Progress", new Dictionary <string, object> { { "Elements Unlocked", GlobalVars.NUMBER_ELEMENTS_UNLOCKED }, { "Highest Tier", Utility.HighestTierUnlocked() } }); }
//when the players crafts their first element for the tutorial public static void CraftedFirstElement(string newElement) { Mixpanel.SendEvent("Crafting An Element For Crafting Tutorial", new Dictionary <string, object> { { "Element", newElement } }); }
//event for using a powerup public static void PowerUpUsed(string powerUpName, int powerUpLevel) { Mixpanel.SendEvent("Power Up Used", new Dictionary <string, object> { { "Power Up", powerUpName }, { "Level", powerUpLevel } }); }
//when the player drags four elments in and the game is ready to launch public static void DraggedElementsInForLaunchGatheringTutorial() { if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Gathering && CraftingTutorialController.TutorialActive) { Mixpanel.SendEvent("Dragged Elements in For Launch Gathering Mission Tutorial", new Dictionary <string, object>()); } }
//when the player opens the crafting menu for the tutorial public static void EnteredCraftingMenu() { if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Crafting && CraftingTutorialController.TutorialActive) { Mixpanel.SendEvent("Opened Crafting Menu For Crafting Tutorial", new Dictionary <string, object>()); } }
//not currently in use, sent every time a player crafts an element public static void ElementCreated(string newElement, string parent1, string parent2, bool isNew) { Mixpanel.SendEvent("Element Created", new Dictionary <string, object> { { "Element", newElement }, { "Combination", parent1 + " + " + parent2 }, { "Is New", isNew } }); }
//when the player enters the powerup menu for the tutorial public static void EnteredPowerUpMenu() { if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.UpgradePowerup && CraftingTutorialController.TutorialActive) { Mixpanel.SendEvent("Opened PowerUp Menu For Buy Power Up Upgrade Tutorial", new Dictionary <string, object>()); } }
void OnTriggerEnter(Collider other) { //Finish if (other.gameObject.CompareTag("End")) { speed = 0.0f; animator.Play("Wary"); finished = true; FinishPanel.FadeIn(); HeaderPanel.FadeOut(); int score = GetFinalScore(); double obstacleResult = Math.Round(obstacles * obstacleModifier, 1); obstacleFinishText.text = string.Format("= {0} x {1} = {2}", obstacles, Math.Round(obstacleModifier, 1), obstacleResult); double coinResult = Math.Round(coins * coinModifier, 1); coinFinishText.text = string.Format("= {0} x {1} = {2}", coins, Math.Round(coinModifier, 1), coinResult); TimeFinishText.text = string.Format("= {0:00}:{1:00} = {2}", minutes, Mathf.Floor(seconds), score - obstacleResult - coinResult); scoreFinishText.text = string.Format("Score = {0}", score); if (MPScript.Data.Match != null) { Mixpanel.SendEvent("Multiplayer Game Finished", new Dictionary <string, object> { { "opponent", MPScript.Data.Match.OpponentId }, { "score", score }, { "seconds", minutes * 60 + seconds }, { "coins", coins } }); APIController.UpdateMatch(new Guid(MPScript.Data.Match.MatchId), (int)score, true); } else if (MPScript.Data.ChallengedPlayers != null) { Guid replayId = APIController.SaveReplay(replay.ToString()); Mixpanel.SendEvent("Multiplayer Game Challenged", new Dictionary <string, object> { { "score", score }, { "seconds", minutes * 60 + seconds }, { "coins", coins } }); foreach (Player player in MPScript.Data.ChallengedPlayers) { APIController.SaveMatch(Mixpanel.DistinctID, score, player.PlayerId, replayId, GlobalRandom.Seed); } } else { Mixpanel.SendEvent("Game Finished", new Dictionary <string, object> { { "score", score }, { "seconds", minutes * 60 + seconds }, { "coins", coins } }); MPScript.Data.SessionClient.UpdateLeaderboard(leaderboardsId, (long)score, onLeaderboardUpdated, onError); } APIController.IncrementSEP(activeSEP, coins); MPScript.Data.Clean(); } }
//when the player drags in two elements for the tutorial public static void DraggedInTwoElements(bool ready) { if (ready && CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Crafting && CraftingTutorialController.TutorialActive) { Mixpanel.SendEvent("Dragged Two Elements In For Crafting Tutorial", new Dictionary <string, object>()); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { Mixpanel.SendEvent("Got hit by a car", new Dictionary <string, object> { { "Level", level } }); game.GameOver(); } }
public void Start() { // set token Mixpanel.Token = "79891f4e593931bc11090bd44ae01f54"; // send game start Mixpanel.SendEvent("GameStart", new Dictionary <string, object> { { "Platform", Application.platform.ToString() }, { "LocalTime", DateTime.Now.ToShortTimeString() } }); }
public void Start() { SetupMixpanel(); if (PlayerHasPreviouslyDied()) { Mixpanel.SendEvent("Tried to restart"); GameOver(); return; } Mixpanel.SendEvent("Started game"); }
public void SetupMixpanel() { Mixpanel.Token = "MIXPANEL TOKEN GOES HERE"; Mixpanel.SuperProperties.Add("Platform", Application.platform.ToString()); Mixpanel.SuperProperties.Add("Quality", QualitySettings.names[QualitySettings.GetQualityLevel()]); Mixpanel.SuperProperties.Add("Fullscreen", Screen.fullScreen); Mixpanel.SuperProperties.Add("Screen Height", Screen.height); Mixpanel.SuperProperties.Add("Screen Width", Screen.width); Mixpanel.SuperProperties.Add("Resolution", Screen.width + "x" + Screen.height); Mixpanel.SendEvent("Ran program"); }
//sent when the player exits crafting public static void CraftingPlaySession() { Mixpanel.SendEvent("Crafting Play Session", new Dictionary <string, object> { { "Session Play Time", Utility.SecondsToTimeString(Time.timeSinceLevelLoad) }, { "Elements Unlocked in Session", ElementsUnlockedInSession }, { "Tiers Unlocked in Session", TiersUnlockedInSession }, { "Tiers Completed in Session", TiersCompletedInSession }, { "Elements Crafted In Session", ElementsCraftedInSession }, { "Hints Bought in Session", HintsBoughtInSession }, { "Power Up Upgrades Bought in Session", PowerUpUpgradesBoughtInSession } }); ResetSessionVariables(GlobalVars.Scenes.Crafting); }
//sent every time the player discovers a new element public static void ElementDiscovered(string newElement) { ElementsUnlockedInSession++; Mixpanel.SendEvent("Element Discovered", new Dictionary <string, object> { { "Element", newElement } }); //calls the tutorial event, if the tutorial is currently active if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Crafting && CraftingTutorialController.TutorialActive) { CraftedFirstElement(newElement); } }
public void buttonPauseClick() { if (Time.timeScale == 0.0f) { Time.timeScale = 1f; paused = false; Mixpanel.SendEvent("Unpaused"); } else { Time.timeScale = 0.0f; paused = true; Mixpanel.SendEvent("Paused"); } }
public void OnGUI() { GUILayout.Label("This is an example demonstrating how to use the Mixpanel integration plugin for Unity3D."); GUILayout.Label("All source code for this example is located in \"Assets/Mixpanel Analytics/MixpanelExample.cs\"."); if (string.IsNullOrEmpty(Mixpanel.Token)) { GUI.color = Color.red; GUILayout.Label("Step 1: Set the Token property on the 'Mixpanel Example' object to your unique Mixpanel token string."); } if (string.IsNullOrEmpty(Mixpanel.Token)) { return; } GUILayout.BeginHorizontal(); GUILayout.Label("Event Name:"); _eventName = GUILayout.TextField(_eventName); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Property 1:"); _property1 = GUILayout.TextField(_property1); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Property 2:"); _property2 = GUILayout.TextField(_property2); GUILayout.EndHorizontal(); if (GUILayout.Button("Send Event")) { Dictionary <string, object> info = new Dictionary <string, object> { { "property1", _property1 }, { "property2", _property2 }, }; Mixpanel.EnableLogging = true; Mixpanel.SendEvent(_eventName, info); Mixpanel.SendUser(info); } }
private void RetrieveName(IGraphResult result) { foreach (var a in result.ResultDictionary) { Debug.Log(a.Key + "-" + a.Value); } string id = (string)result.ResultDictionary["id"]; string name = String.Format("{0} {1}", result.ResultDictionary["first_name"], result.ResultDictionary["last_name"]); // API APIController.SavePlayer(id, name.Replace(" ", "%20"), AccessToken.CurrentAccessToken.TokenString); // HeroicLabs Client.ApiKey = "31c210da7f0b4110bc301544870733d6"; Client.Ping(onError); Client.LoginOAuthFacebook(AccessToken.CurrentAccessToken.TokenString, (SessionClient session) => { MPScript.Data.SessionClient = session; MPScript.Data.SessionClient.Gamer((Gamer gamer) => { string nickname = name.Replace(' ', '_'); if (gamer.Nickname != nickname) { MPScript.Data.SessionClient.UpdateGamer(nickname, onSuccess, onError); } }, onError); }, onError); // Mixpanel Mixpanel.DistinctID = id; Mixpanel.SendUser(new Dictionary <string, object> { { "$first_name", result.ResultDictionary["first_name"] }, { "$last_name", result.ResultDictionary["last_name"] }, { "$name", name }, { "$email", result.ResultDictionary.ContainsKey("email") ? result.ResultDictionary["email"] : "-" } }); Mixpanel.SendEvent("Login"); }
void Start() { float turnRotationValue = gameObject.transform.rotation.y; audio = GetComponent <AudioSource>(); animator = GetComponent <Animator>(); directionMovements = new Dictionary <Direction, Vector3>() { { Direction.North, Vector3.forward }, { Direction.East, Vector3.right }, { Direction.South, Vector3.back }, { Direction.West, Vector3.left } }; controller = GetComponent <CharacterController>(); animator = GetComponent <Animator>(); setSpeed = speed; switchable = true; isDoubleBoost = false; //UI seconds = 0; minutes = 0; coins = 0; obstacles = 0; //jumping; vSpeed = 0.0f; raycastDir = Vector3.down; xPosition = transform.position.x; yPosition = transform.position.y; replay = new Replay(); replayIndex = 0; InvokeRepeating("TrackReplayInfo", 0.2f, 0.2f); Mixpanel.SendEvent("Game Started"); }
//event sent every time the player completes a session in gathering public static void GatheringPlaySession() { Mixpanel.SendEvent("Gathering Play Session", new Dictionary <string, object> { { "Zone 1 Element", PlayerPrefs.GetString("ELEMENT1") }, { "Zone 1 Score", GlobalVars.SCORES[0] }, { "Zone 2 Element", PlayerPrefs.GetString("ELEMENT2") }, { "Zone 2 Score", GlobalVars.SCORES[1] }, { "Zone 3 Element", PlayerPrefs.GetString("ELEMENT3") }, { "Zone 3 Score", GlobalVars.SCORES[2] }, { "Zone 4 Element", PlayerPrefs.GetString("ELEMENT4") }, { "Zone 4 Score", GlobalVars.SCORES[3] }, { "Powerup Spawn Count", GlobalVars.POWERUP_SPAWN_COUNT }, { "Powerup Use Count", GlobalVars.POWERUP_USE_COUNT }, { "Play Time", GlobalVars.GATHERING_PLAYTIME + " Seconds" }, { "Total Number Retained", GlobalVars.SCORES[0] + GlobalVars.SCORES[1] + GlobalVars.SCORES[2] + GlobalVars.SCORES[3] }, { "Total Number Missed", GlobalVars.MISSED }, { "Initial Spawn Rate", GlobalVars.GATHERING_CONTROLLER.initialCreationFrequency }, { "Final Spawn Rate", GlobalVars.GATHERING_CONTROLLER.creationFrequency }, { "Initial Fall Speed", GlobalVars.GATHERING_CONTROLLER.initialElementMovementSpeed }, { "Final Fall Speed", GlobalVars.GATHERING_CONTROLLER.elementMovementSpeed } }); }
/// <summary> /// Send an event to mixpanel. /// </summary> public static void Send(string name, Dictionary <string, object> properties = null) { // check token if (string.IsNullOrEmpty(Mixpanel.Token)) { return; } // create properties if (properties == null) { properties = new Dictionary <string, object>(); } // add times properties.Add("TimeSinceGameStart", Time.realtimeSinceStartup); properties.Add("TimeSinceLevelLoad", Time.timeSinceLevelLoad); // add info properties.Add("LevelName", Application.loadedLevelName); // send Mixpanel.SendEvent(name, properties); }
/// <summary> /// Tapped the enter gathering button. /// </summary> public static void TappedTheEnterGatheringButton() { Mixpanel.SendEvent("Tapped The Enter Gathering Button", new Dictionary <string, object>()); }
/// <summary> /// Tapped the splash screen to enter. /// </summary> public static void TappedSplashScreenToEnter(GlobalVars.Scenes toScene) { Mixpanel.SendEvent("Tapped The Splash Screen To Enter Game", new Dictionary <string, object>()); }
//when the user completes the using powerups tutorial public static void UsePowerUpsTutorialComplete(float time) { Mixpanel.SendEvent("Using powerups Tutorial Complete", new Dictionary <string, object> { { "Completion Time", time } }); }
//for the GATHERING GAME //when the user completes the dragging elements tutorial public static void SwipeElementTutorialComplete(float time) { Mixpanel.SendEvent("Swipe Element Tutorial Complete", new Dictionary <string, object> { { "Completion Time", time } }); }
//when the player switches tiers for the first time public static void TierSwitchingTutorialComplete(float time) { Mixpanel.SendEvent("Tier Switching Tutorial Complete", new Dictionary <string, object> { { "Completion Time", time } }); }
//when the player buys/chooses not to buy their first powerup upgrade public static void BuyPowerUpUpgradeTutorialCompelte(float time) { Mixpanel.SendEvent("Buy Power Up Upgrade Tutorial Complete", new Dictionary <string, object> { { "Completion Time", time } }); }