public void NotesAnalytics() { googleAnalytics.LogEvent(GlobalController.Instance.userName + SceneManager.GetActiveScene().name, "User Clicked Notes", "Assist Page", noteButtonCounter); googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory(GlobalController.Instance.userName + SceneManager.GetActiveScene().name) .SetEventAction("User Clicked Notes") .SetEventLabel("Assist Page") .SetEventValue(noteButtonCounter)); }
public void logOutUser() { saveUserGameData(); analytics.LogEvent(new EventHitBuilder().SetEventCategory("Log out").SetEventAction("User logging out")); analytics.StopSession(); user = null; userID = -1; analytics.LogEvent(new EventHitBuilder().SetEventCategory("Log out").SetEventAction("User has logged out")); analytics.DispatchHits(); }
public void HandleChangeGrav() { if (OnFloor == true) { if (OnPad == true) { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.Joystick1Button0)) { G4.LogEvent("ChangedGravity", "GravityUp", "HasPressed", 1); // Builder Hit with all Event parameters. G4.LogEvent(new EventHitBuilder() .SetEventCategory("ChangedGravity") .SetEventAction("GravityUp") .SetEventLabel("HasPressed") .SetEventValue(1)); Debug.Log("Sent"); Gravity.Play(); transform.Rotate(180, 0, 0); OnFloor = false; OnRoof = true; P1RB.useGravity = false; } } } if (OnRoof == true) { if (OnRoofPad == true) { if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.Joystick1Button0)) { G4.LogEvent("ChangedGravity", "GravityDown", "HasPressed", 1); // Builder Hit with all Event parameters. G4.LogEvent(new EventHitBuilder() .SetEventCategory("ChangedGravity") .SetEventAction("GravityDown") .SetEventLabel("HasPressed") .SetEventValue(1)); Debug.Log("Sent"); Gravity.Play(); transform.Rotate(180, 0, 0); OnFloor = true; OnRoof = false; P1RB.useGravity = true; } } } }
public void SendEvent(string name) { EventHitBuilder ehb = new EventHitBuilder(); ehb.SetEventAction(name); GoogleAnalytics.LogEvent(ehb); }
public void treckEvent(AnaliticsCategory category, string action, string label, long value = 0) { if (googleAnalytics != null) { googleAnalytics.LogEvent(category.ToString(), action, label, value); } }
public void BackToMenu() { G4.LogEvent("PressButton", "BackButton", "HasPressed", 1); // Builder Hit with all Event parameters. G4.LogEvent(new EventHitBuilder() .SetEventCategory("PressButton") .SetEventAction("BackButton") .SetEventLabel("HasPressed") .SetEventValue(1)); Debug.Log("Sent"); HowUI.SetActive(false); ControlsMenu.SetActive(false); StartMenu.SetActive(true); }
// public methods public void EndGame() { // we ended the round and shall show End prompt audioPlayer.StopAudio(); questionTitleText.enabled = false; logoUI.enabled = false; quizzUI.SetActive(false); promptUI.SetActive(false); scoreUI.SetActive(true); Debug.Log("Total Yes: " + _yesCounter + ", Loaded Clips: " + _loadedClips.Count); float score = Mathf.RoundToInt((_yesCounter / _loadedClips.Count) * 100); Debug.Log("Score: " + score + "%"); scoreText.text = score.ToString() + "%"; // Anylitcs stuff GoogleAnalyticsV4 GA = GoogleAnalyticsV4.instance; if (GA != null) { GA.LogEvent("Complete " + GameData.GAME_CATEGORY, "User Id; " + GameData.USER_ID, score.ToString() + "%", 1); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { switch (this.tag) { case "BeginLevel": wordDisplay.text = "Use the left and right arrow keys to move the player. \n Use spacebar to jump."; Time.timeScale = 0.0f; Destroy(this.gameObject); break; case "Objective": wordDisplay.text = "You may encounter some helpful people along your journey...\nMake sure you take their advice."; Destroy(this.gameObject); break; case "Controls": wordDisplay.text = "Press the 'p' key to pause/resume. \n\n Press Spacebar to jump."; Time.timeScale = 0.0f; Destroy(this.gameObject); break; case "BeforeReview": wordDisplay.text = "Press the up key over the door to continue to the review section."; Time.timeScale = 0.0f; Destroy(this.gameObject); break; case "BossJIT": wordDisplay.text = "Get ready to battle the boss.\n\nJump on the boss to receive a question. Answer 5 questions right to kill the boss."; Time.timeScale = 0.0f; Destroy(this.gameObject); break; case "Level2JIT": BookScript.bookControl.ResetBooks(); /* * Category -- LevelReached * Action --name (e.g. [email protected]) * Label -- blank * Value -- level # * This should be added just before a level is loaded. */ googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("LevelReached") .SetEventAction(EnterNameScript.Instance.Name) .SetEventLabel("") .SetEventValue(2)); //When we create mode for game, it should be entered HERE SceneManager.LoadScene("Level2"); break; } } }
public void SendEmptyTapAnalytics() { for (int c = 0; c < areaCounters.Count; c++) { GAv4.LogEvent(new EventHitBuilder().SetEventCategory("Empty_tap") .SetEventAction("Tap") .SetEventLabel("Empty_area_" + (c + 1)) .SetEventValue(areaCounters [c])); } }
/* * Category -- LevelReached * Action --name (e.g. [email protected]) * Label -- blank * Value -- level # */ public void GoToLevel2() { googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("LevelReached") .SetEventAction(EnterNameScript.Instance.Name) .SetEventLabel("") .SetEventValue(2)); //When we create mode for game, it should be entered HERE SceneManager.LoadScene("Level2"); }
public void LogEvent(string type, string action, string description, long value) { if (shouldInit) { ga.LogEvent(type, action, description, value); if (type == "Screen") { LogScreen(action); } } }
public static void LogEvent(string eventCategory, string eventAction, string eventLabel, long value) { if (googleAnalytics != null) { googleAnalytics.LogEvent(eventCategory, eventAction, eventLabel, value); } else { "googleAnalyticsがnullです".LogWarning(); } }
public void PlayM() { Debug.Log("play movie"); if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { Handheld.PlayFullScreenMovie(movieName, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFit); Debug.Log("play movie"); googleAnalytics.LogEvent("Video", movieName, movieName, 1); } }
// privates private void InitUser() { const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; System.Random random = new System.Random(); if (GameData.USER_ID == string.Empty) { GameData.USER_ID = new string(Enumerable.Repeat(chars, 4).Select(s => s[random.Next(s.Length)]).ToArray()); GoogleAnalytics.LogEvent("Loggin", "New User", "User Id: " + GameData.USER_ID, 1); } }
public void ExternalOpenPDF() { #if UNITY_ANDROID StartCoroutine(PDFReader.OpenDocLocal(namePDF)); #endif #if UNITY_IPHONE PDFReader.OpenDocInMenu(streamingPdf, true); #endif Debug.Log("OPEN PDF"); googleAnalytics.LogEvent("Literature", namePDF, namePDF, 1); }
public void SendEvent(string category, string action = null, string label = null, long value = 0) { if (ga != null) { EventHitBuilder builder = GetEventHitBuilder(); builder.SetEventCategory(category); builder.SetEventAction(action); builder.SetEventLabel(label); builder.SetEventValue(value); ga.LogEvent(builder); } }
/// <summary> /// Will only send data if not in Editor mode. /// </summary> /// <param name="GA">G.</param> /// <param name="DFVersion">Dwarf Fortress version.</param> /// <param name="pluginVersion">Plugin version.</param> public static void SendDeviceData(this GoogleAnalyticsV4 GA, string DFVersion, string pluginVersion) { #if !UNITY_EDITOR GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("Graphics Card") .SetEventAction(SystemInfo.graphicsDeviceVendor) .SetEventLabel(SystemInfo.graphicsDeviceName) .SetEventValue(1) .Validate() ); GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("Processor") .SetEventAction("Core number") .SetEventLabel(SystemInfo.processorCount.ToString()) .SetEventValue(1) .Validate() ); GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("Processor") .SetEventAction("Core frequency") .SetEventLabel(SystemInfo.processorFrequency.ToString()) .SetEventValue(1) .Validate() ); GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("OS Version") .SetEventAction(SystemInfo.operatingSystem) .SetEventLabel(SystemInfo.operatingSystem) .SetEventValue(1) .Validate() ); GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("Program Version") .SetEventAction("Dwarf Fortress Version") .SetEventLabel(DFVersion) .SetEventValue(1) .Validate() ); GA.LogEvent(new EventHitBuilder() .SetCustomDimension(1, SystemInfo.operatingSystemFamily.ToString()) .SetEventCategory("Program Version") .SetEventAction("Plugin Version") .SetEventLabel(pluginVersion) .SetEventValue(1) .Validate() ); #endif }
void Awake() { PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() // registers a callback to handle game invitations received while the game is not running. .WithInvitationDelegate(InvitationManager.Instance.OnInvitationReceived) .Build(); PlayGamesPlatform.InitializeInstance(config); // recommended for debugging: PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); #if UNITY_ANDROID MultiplayerController.Instance.TrySilentSignIn(); #endif #if UNITY_IOS GameData.Instance.Get(); if (GameData.Instance.loggedIn > 0) { MultiplayerController.Instance.TrySilentSignIn(); } UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #endif ParsePush.ParsePushNotificationReceived += (sender, args) => { #if UNITY_ANDROID AndroidJavaClass parseUnityHelper = new AndroidJavaClass("com.parse.ParseUnityHelper"); AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject currentActivity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); // Call default behavior. parseUnityHelper.CallStatic("handleParsePushNotificationReceived", currentActivity, args.StringPayload); #endif }; // Your Publisher ID is: 1f256a74c0178cb111a2cde78a93d2a2 HeyzapAds.Start("1f256a74c0178cb111a2cde78a93d2a2", HeyzapAds.FLAG_NO_OPTIONS); googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("app_action") .SetEventAction("launch") .SetEventLabel("launched")); }
public void failureAnalytics() { googleAnalytics.LogEvent(GlobalController.Instance.userName + camName, "Number of Failures", "Failed a Challenge", failedAttempts); googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory(GlobalController.Instance.userName + camName) .SetEventAction("Number of Failures") .SetEventLabel("Failed a Challenge") .SetEventValue(failedAttempts)); }
private void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Player") { if (Op == true) { Vic.Play(); VictoryOn = true; P.canbox = false; Time.timeScale = 0; Debug.Log("YouWin " + "Time: " + Timer.TimeScoreHours + ":" + Timer.TimeScoreMin + ":" + Timer.TimeScoreSeconds.ToString("f2")); G4.LogEvent("finalscore", "score", "gamevictory", 1); // Builder Hit with all Event parameters. G4.LogEvent(new EventHitBuilder() .SetEventCategory("finalscore") .SetEventAction("score") .SetEventLabel("gamevictory") .SetEventValue(1)); Debug.Log("Sent"); } } }
public void HandleResetButton() { G4.LogEvent("PressButton", "ResetButtonButton", "HasPressed", 1); // Builder Hit with all Event parameters. G4.LogEvent(new EventHitBuilder() .SetEventCategory("PressButton") .SetEventAction("ResetButtonButton") .SetEventLabel("HasPressed") .SetEventValue(1)); Debug.Log("Sent"); if (Section1 == true) { Plyr1.position = new Vector3(-20, Plyr1.position.y, Plyr1.position.z); Plyr2.position = new Vector3(-20, Plyr2.position.y, Plyr2.position.z); } if (Section2 == true) { Plyr1.position = new Vector3(30, Plyr1.position.y, Plyr1.position.z); Plyr2.position = new Vector3(30, Plyr2.position.y, Plyr2.position.z); } if (Section3 == true) { Plyr1.position = new Vector3(80, Plyr1.position.y, Plyr1.position.z); Plyr2.position = new Vector3(80, Plyr2.position.y, Plyr2.position.z); Box1.position = new Vector3(110, -2.8f, Box1.position.z); } if (Section4 == true) { Plyr1.position = new Vector3(130, Plyr1.position.y, Plyr1.position.z); Plyr2.position = new Vector3(130, Plyr2.position.y, Plyr2.position.z); Box2.position = new Vector3(135, -2.8f, Box2.position.z); Box3.position = new Vector3(140, -2.8f, Box3.position.z); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { Vector2 point = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(point, Vector2.zero, 24f); if (hit.collider != null) { GAv4.LogEvent(new EventHitBuilder().SetEventCategory("Something") .SetEventAction("Tap") .SetEventLabel("Element_tap") .SetEventValue(12)); print("elem_tap"); } else if (hit.collider == null) { GAv4.LogEvent(new EventHitBuilder().SetEventCategory("EmtyArea_1") .SetEventAction("Tap") .SetEventLabel("Empty_tap") .SetEventValue(24)); print("empty_tap"); } } }
public void PlayGame() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); googleAnalytics.LogEvent("Load", "Level_1", "Playing", 1); // Builder Hit with all Timing parameters. googleAnalytics.GetComponent <GoogleAnalyticsV4>().LogTiming(new TimingHitBuilder() .SetTimingCategory("Loading") .SetTimingInterval(50L) .SetTimingName("Level_1") .SetTimingLabel("First load")); }
public void LogEvent(string eventAction, string eventLabel, long value) { Debug.Log("=== Log Event = " + eventAction); _googleAnalytics.LogEvent("Game Event", eventAction, eventLabel, value); AnalyticsEvent.Custom( eventAction, new Dictionary <string, object> { { "label", eventLabel }, { "value", value } }); }
public void showHZAdVideos() { googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("game_action") .SetEventAction("heyzap_advideos") .SetEventLabel("video")); if (HZIncentivizedAd.IsAvailable()) { HZIncentivizedAd.Show(); } HZIncentivizedAd.Fetch(); // // Later, such as after a level is completed // if (HZVideoAd.IsAvailable()) { // HZVideoAd.Show(); // HZVideoAd.Fetch(); // } }
//Checks to see if Input is empty and shows warning sign if it is //Saves it in PlayerPrefs and continues to Level1 scene otherwise public void Continue() { Name = NameInputFieldText.text.Trim(); Debug.Log("Name is " + Name); if (string.IsNullOrEmpty(Name)) { RequiredText.text = "*Required"; return; } ver = Version.Instance.version; Debug.Log("in EnterNameScript: version = " + ver); PlayerPrefs.SetString("CurrentPlayer", Name); googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory("ModeOfPlay") .SetEventAction(Name) .SetEventLabel("") .SetEventValue(ver)); //When we create mode for game, it should be entered HERE SceneManager.LoadScene("Level1"); }
/* * public string pickQuestion(){ * //list of all keys in questionAnswers * print("inside pickQuestion"); * //check level first, if level 1 question 1-5 * int quest = Random.Range(0,5); * * keyList = new List<string> (questionsAnswers.Keys); * * //assign element at a random index from 0 to size of keyList to the string randomKey (will be our question) * //string randomKey = keyList[Random.Range(0, keyList.Count-1)]; * string randomKey = keyList[Random.Range(0, 3)]; * print ("randomkey chose:"); * print (randomKey); * while (isQuesUsed (randomKey)) { * randomKey = keyList[Random.Range(0, keyList.Count-1)]; * } * assignAnswers (questionsAnswers [randomKey]); * return randomKey; * } */ /* * public void assignAnswers(string correct){ * correct_index = Random.Range (0, NumChoices-1); * print("The correct index inside bossquestions is:"); * print(correct_index); * * multiple_choice = new string[NumChoices]; * multiple_choice [correct_index] = correct; * currAnswers.Add (correct); * * for (int i = 0; i <= NumChoices-1; i++) { * if (i != correct_index) { * /* * int rand = Random.Range (0, answerOptions.Count - 1); * string ans = answerOptions [rand]; * * * while (currAnswers.Contains (ans)) { * rand = Random.Range (0, answerOptions.Count - 1); * ans = answerOptions [rand]; * } * //if (answerOptions [rand] != correct ) * multiple_choice [i] = ans; * currAnswers.Add (ans); */ /*multiple_choice[i] = answer; * * } * else * continue; * * } * * currAnswers.Clear (); * * }*/ /* public bool isQuestionUsed(string word){ // check if question was already used * foreach (string str in questionsAnswers.Keys) { * if ( word == str ) { * return true; * } * } * return false; * }*/ //checks if player got question correct public bool checkAnswer(string playerAnswer) { print("answer is " + questions[indexUsed[indexUsed.Count - 1]].answer); //if (questions[indexUsed[indexUsed.Count-1]].answer.Equals (playerAnswer)) { if (questions[indexUsed[indexUsed.Count - 1]].answer.Equals(playerAnswer)) { return(true); } /* * * EventHitBuilder eventHitBuilder = new EventHitBuilder(); * eventHitBuilder.SetEventCategory (playerAnswer); * eventHitBuilder.SetEventLabel (""); * eventHitBuilder.SetEventValue (2); * string playerName = PlayerPrefs.GetString ("CurrentPlayer"); * if (playerName != null) * eventHitBuilder.SetEventAction (playerName); * else * eventHitBuilder.SetEventAction ("No name"); * googleAnalytics.LogEvent (eventHitBuilder); */ googleAnalytics.LogEvent(new EventHitBuilder() .SetEventCategory(playerAnswer) .SetEventAction(indexUsed.ToString()) //indexUsed - cast to string .SetEventLabel("Player Name") //not sure what this is supposed to be .SetEventValue(1)); //When we create mode for game, it should be entered HERE //ver = Version.getVersion(); /*LOG INCORRECT answer only * category incorrectAnswer which choice selected * action questionIndex - index of question used * label Name - ?????? * vaule answer (incorrect) - ????? index of answer seleceted? * /*/ return(false); }
async Task Start() { googleAnalytics.LogScreen("Game"); // TODO Добавить GameType и LobbyDeckId googleAnalytics.LogEvent( new EventHitBuilder() .SetEventCategory(AnalyticsEventsCategory.Game) .SetEventAction(AnalyticsEvents.EnteredTheGame) .SetCustomDimension(AnalyticsDemention.GameId, GameState.gameId) .SetCustomDimension(AnalyticsDemention.PlayerId, GameState.mainPlayerId) ); var gameData = await LoadGame(); CardCreator cardCreator = this.GetComponent <CardCreator>(); List <CardDisplay> cardDisplays = cardCreator.CreateCards(gameData); this.LoadSounds(cardDisplays); CardManager cardManager = this.GetComponent <CardManager>(); cardManager.Init(); this.OnGameDataFirstTimeRecived(); CursorController.SetDefault(); if (GameState.gameData.game.gameEnded) { this.uiManager.ShowWinStatus(); } else { this.uiManager.ShowTurn(); } }
void Start() { googleAnalytics.StartSession(); googleAnalytics.LogScreen("Main menu"); if (!MainMenu.appRunned) { googleAnalytics.LogEvent(AnalyticsEventsCategory.App, AnalyticsEvents.AppRunned); MainMenu.appRunned = true; } var tutorialButton = this.transform.Find("Container/TutorialButton").GetComponent <Button>(); var lobbyButton = this.transform.Find("Container/LobbyButton").GetComponent <Button>(); var singlePlayerButton = this.transform.Find("Container/SinglePlayerButton").GetComponent <Button>(); var multiPlayerButton = this.transform.Find("Container/MultiPlayerButton").GetComponent <Button>(); CursorController.SetDefault(); tutorialButton.onClick.AddListener(this.OnTutorialButtonClick); lobbyButton.onClick.AddListener(this.OnLobbyButtonClick); singlePlayerButton.onClick.AddListener(this.OnSinglePlayerButtonClick); multiPlayerButton.onClick.AddListener(this.OnMultiPlayerButtonClick); }
void LogStats(Grid grid) { Boat[] boats = grid.boats; int units = 0; int sunk = 0; int hits = 0; int misses = grid.getMisses(); for (int i = 0; i < boats.Length; i++) { BoatConfiguration config = boats [i].config; units += config.size; hits += boats [i].HitCount(); if (boats [i].IsSunk()) { sunk++; } } gav4.LogEvent(CATEGORY, grid.whose.ToString() + "-HitsOutOf" + units, null, hits); gav4.LogEvent(CATEGORY, grid.whose.ToString() + "-SunkOutOf" + boats.Length, null, sunk); gav4.LogEvent(CATEGORY, grid.whose.ToString() + "-AccuracyPercent", null, AccuracyPercent(hits, misses)); }