Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class GATracker : MonoBehaviour {
  5.  
  6. public GoogleAnalyticsV3 googleAnalytics;
  7.  
  8.  
  9. void Start(){
  10.  
  11.  
  12.  
  13. googleAnalytics.StartSession ();
  14.  
  15. GAGameMuted ();
  16. }
  17.  
  18. void OnApplicationQuit(){
  19.  
  20. googleAnalytics.StopSession ();
  21.  
  22. }
  23.  
  24.  
  25.  
  26. // JUEGO DE LA GOTA -------------------------------------------
  27.  
  28.  
  29. //ficha con la que se juega
  30. public void GASendToken(EmojiEnum _token){
  31. googleAnalytics.LogEvent(new EventHitBuilder()
  32. .SetEventCategory("JuegoDeLaGota")
  33. .SetEventAction("Final de la partida")
  34. .SetEventLabel("Ficha Jugada : " + _token)
  35. .SetEventValue(1));
  36. }
  37.  
  38. //partidas finalizadas
  39. public void GAGameEnd(){
  40. googleAnalytics.LogEvent(new EventHitBuilder()
  41. .SetEventCategory("JuegoDeLaGota")
  42. .SetEventAction("Final de la partida")
  43. .SetEventLabel("Partida Finalizada")
  44. .SetEventValue(1));
  45. }
  46.  
  47.  
  48. //juego muteado
  49. public void GAGameMuted(){
  50. googleAnalytics.LogEvent(new EventHitBuilder()
  51. .SetEventCategory("JuegoDeLaGota")
  52. .SetEventAction("Opciones")
  53. .SetEventLabel("Sonido desactivado")
  54. .SetEventValue(1));
  55. }
  56.  
  57. //Salir en mitad de la partida
  58. public void GASaveGame(){
  59. googleAnalytics.LogEvent(new EventHitBuilder()
  60. .SetEventCategory("JuegoDeLaGota")
  61. .SetEventAction("Opciones")
  62. .SetEventLabel("Juego abandonado")
  63. .SetEventValue(1));
  64. }
  65.  
  66. //COMEGOTAS -----------------------------------------------------
  67.  
  68.  
  69. //Nivel de dificultad Seleccionado
  70.  
  71. public void GADificultySelected(string dificultad){
  72. googleAnalytics.LogEvent(new EventHitBuilder()
  73. .SetEventCategory("Comegotas")
  74. .SetEventAction("Menu")
  75. .SetEventLabel("Dificultad " + dificultad + " seleccionada")
  76. .SetEventValue(1));
  77. }
  78.  
  79. //mundo seleccionado
  80. public void GASendDificultySelected(string mundo){
  81. googleAnalytics.LogEvent(new EventHitBuilder()
  82. .SetEventCategory("Comegotas")
  83. .SetEventAction("Menu")
  84. .SetEventLabel("Mundo de " + mundo + " seleccionado")
  85. .SetEventValue(1));
  86. }
  87.  
  88. //puntuacion obtenida
  89. public void GASendScoreInfo(int score){
  90. googleAnalytics.LogEvent(new EventHitBuilder()
  91. .SetEventCategory("Comegotas")
  92. .SetEventAction("Final de partida")
  93. .SetEventLabel("Puntuacion conseguida")
  94. .SetEventValue(score));
  95. }
  96. //nivel conseguido
  97. public void GASendScore(int level){
  98. googleAnalytics.LogEvent(new EventHitBuilder()
  99. .SetEventCategory("Comegotas")
  100. .SetEventAction("Final de partida")
  101. .SetEventLabel("Nivel alcanzado")
  102. .SetEventValue(level));
  103. }
  104.  
  105. //Salir de la partida ( en curso)
  106. public void GALeaveGame(){
  107. googleAnalytics.LogEvent(new EventHitBuilder()
  108. .SetEventCategory("Comegotas")
  109. .SetEventAction("Opciones")
  110. .SetEventLabel("Juego abandonado")
  111. .SetEventValue(1));
  112. }
  113.  
  114.  
  115.  
  116. //GENERAL---------------------------------------------------------------
  117.  
  118.  
  119.  
  120. //pantalla seleccionada
  121. public void GAScreenSelected( string _screenName){
  122.  
  123. googleAnalytics.LogScreen(new AppViewHitBuilder()
  124. .SetScreenName(_screenName));
  125.  
  126. }
  127.  
  128.  
  129. //campañas
  130.  
  131. public void GACampaignStarted( string nombre, string contenido ,string medio ,string origen , string id){
  132.  
  133. googleAnalytics.LogTiming(new TimingHitBuilder()
  134. .SetTimingCategory("Loading")
  135. .SetTimingInterval(50L)
  136. .SetTimingName("Main Menu")
  137. .SetTimingLabel("First load")
  138. .SetCampaignName(nombre)
  139. .SetCampaignSource(origen)
  140. .SetCampaignMedium(medio)
  141. .SetCampaignKeyword("games")
  142. .SetCampaignContent(contenido)
  143. .SetCampaignID(id));
  144. }
  145.  
  146.  
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement