< Summary

Class:ExploreV2Analytics.ExploreV2Analytics
Assembly:ExploreV2Analytics
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Analytics/ExploreV2Analytics/ExploreV2Analytics.cs
Covered lines:0
Uncovered lines:118
Coverable lines:118
Total lines:305
Line coverage:0% (0 of 118)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:24
Method coverage:0% (0 of 24)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SendStartMenuVisibility(...)0%12300%
SendStartMenuSectionVisibility(...)0%12300%
SendEventTeleport(...)0%2100%
SendParticipateEvent(...)0%2100%
SendRemoveParticipateEvent(...)0%2100%
SendClickOnEventInfo(...)0%2100%
SendPlaceTeleport(...)0%2100%
SendWorldTeleport(...)0%2100%
SendClickOnPlaceInfo(...)0%2100%
SendClickOnWorldInfo(...)0%2100%
TeleportToPlaceFromFavorite(...)0%2100%
SendSearchEvents(...)0%2100%
SendSearchPlaces(...)0%2100%
SendSearchWorlds(...)0%2100%
SendPlacesTabOpen()0%2100%
SendWorldsTabOpen()0%2100%
SendEventsTabOpen()0%2100%
SendFavoritesTabOpen()0%2100%
SendFilterEvents(...)0%12300%
SendClickedNavmapSearchResult(...)0%2100%
SendToggleMapLayer(...)0%2100%
SendOpenGenesisCityUrl()0%2100%
SendCenterMapToHome()0%2100%
SendCenterMapToPlayer()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Analytics/ExploreV2Analytics/ExploreV2Analytics.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5namespace ExploreV2Analytics
 6{
 7    public interface IExploreV2Analytics
 8    {
 9        void SendStartMenuVisibility(bool isVisible, ExploreUIVisibilityMethod method);
 10        void SendStartMenuSectionVisibility(ExploreSection section, bool isVisible);
 11        void SendEventTeleport(string eventId, string eventName, bool isWorld, Vector2Int coords, ActionSource source = 
 12        void SendClickOnEventInfo(string eventId, string eventName, bool isWorld, int resultPosition = -1, ActionSource 
 13        void SendPlaceTeleport(string placeId, string placeName, Vector2Int coords, ActionSource source = ActionSource.F
 14        void SendWorldTeleport(string worldId, string worldName, ActionSource source = ActionSource.FromExplore);
 15        void SendClickOnPlaceInfo(string placeId, string placeName, int resultPosition = -1, ActionSource source = Actio
 16        void SendClickOnWorldInfo(string worldId, string worldName, int resultPosition = -1, ActionSource source = Actio
 17        void SendParticipateEvent(string eventId, bool isWorld, ActionSource source = ActionSource.FromExplore);
 18        void SendRemoveParticipateEvent(string eventId, bool isWorld, ActionSource source = ActionSource.FromExplore);
 19        void TeleportToPlaceFromFavorite(string placeUUID, string placeName);
 20        void SendSearchEvents(string searchString, Vector2Int[] firstResultsCoordinates, string[] firstResultsIds);
 21        void SendSearchPlaces(string searchString, Vector2Int[] firstResultsCoordinates, string[] firstResultsIds, Actio
 22        void SendSearchWorlds(string searchString, string[] firstResultsIds);
 23        void SendPlacesTabOpen();
 24        void SendWorldsTabOpen();
 25        void SendEventsTabOpen();
 26        void SendFavoritesTabOpen();
 27        void SendFilterEvents(FilterType filterType, string filterValue = "");
 28        void SendClickedNavmapSearchResult(Vector2Int coordinatesOfResult);
 29        void SendToggleMapLayer(string layerName, bool isActive);
 30        void SendOpenGenesisCityUrl();
 31        void SendCenterMapToHome();
 32        void SendCenterMapToPlayer();
 33    }
 34
 35    public class ExploreV2Analytics : IExploreV2Analytics
 36    {
 37        private const string START_MENU_VISIBILITY = "start_menu_visibility";
 38        private const string START_MENU_SECTION_VISIBILITY = "start_menu_section_visibility";
 39        private const string EXPLORE_EVENT_TELEPORT = "explore_event_teleport";
 40        private const string EXPLORE_CLICK_EVENT_INFO = "explore_click_event_info";
 41        private const string EXPLORE_SEARCH_EVENTS = "explore_search_events";
 42        private const string EXPLORE_SEARCH_PLACES = "explore_search_places";
 43        private const string EXPLORE_SEARCH_WORLDS = "explore_search_worlds";
 44        private const string EXPLORE_PARTICIPATE_EVENT = "explore_participate_event";
 45        private const string EXPLORE_REMOVE_PARTICIPATE_EVENT = "explore_remove_participate_event";
 46        private const string EXPLORE_PLACE_TELEPORT = "explore_place_teleport";
 47        private const string EXPLORE_WORLD_TELEPORT = "explore_world_teleport";
 48        private const string EXPLORE_CLICK_PLACE_INFO = "explore_click_place_info";
 49        private const string EXPLORE_CLICK_WORLD_INFO = "explore_click_world_info";
 50        private const string TELEPORT_FAVORITE_PLACE = "player_teleport_to_favorite_place";
 51        private const string EXPLORE_PLACES_TAB_OPEN = "explore_places_tab_open";
 52        private const string EXPLORE_WORLDS_TAB_OPEN = "explore_worlds_tab_open";
 53        private const string EXPLORE_EVENTS_TAB_OPEN = "explore_events_tab_open";
 54        private const string EXPLORE_FAVORITES_TAB_OPEN = "explore_favorites_tab_open";
 55        private const string FILTER_EVENTS = "player_filter_events";
 56        private const string SELECT_NAVMAP_HISTORY_RESULT = "clicked_navmap_search_result";
 57        private const string TOGGLE_MAP_LAYER = "toggle_map_layer";
 58        private const string MAP_CENTER_HOME = "map_center_home";
 59        private const string MAP_CENTER_TO_PLAYER = "map_center_to_player";
 60        private const string MAP_OPEN_GENESIS_CITY_URL = "map_open_genesis_city_url";
 61
 62        private static DateTime? exploreMainMenuSetVisibleTimeStamp = null;
 63        private static DateTime? exploreSectionSetVisibleTimeStamp = null;
 64        private static DateTime? eventTimeFilterTimeStamp = null;
 65
 66        private const int MIN_TIME_TO_SEND_EVENT_TIME_FILTER_METRIC = 5;
 67
 68        public void SendStartMenuVisibility(bool isVisible, ExploreUIVisibilityMethod method)
 69        {
 070            Dictionary<string, string> data = new Dictionary<string, string>();
 071            data.Add("visible", isVisible.ToString());
 072            data.Add("method", method.ToString());
 73
 074            if (isVisible)
 075                exploreMainMenuSetVisibleTimeStamp = DateTime.Now;
 76            else
 77            {
 078                if (exploreMainMenuSetVisibleTimeStamp.HasValue)
 79                {
 080                    data.Add("open_duration_ms", (DateTime.Now - exploreMainMenuSetVisibleTimeStamp.Value).TotalMillisec
 081                    exploreMainMenuSetVisibleTimeStamp = null;
 82                }
 83            }
 84
 085            GenericAnalytics.SendAnalytic(START_MENU_VISIBILITY, data);
 086        }
 87
 88        public void SendStartMenuSectionVisibility(ExploreSection section, bool isVisible)
 89        {
 090            Dictionary<string, string> data = new Dictionary<string, string>();
 091            data.Add("section", section.ToString());
 092            data.Add("visible", isVisible.ToString());
 93
 094            if (isVisible)
 095                exploreSectionSetVisibleTimeStamp = DateTime.Now;
 96            else
 97            {
 098                if (exploreSectionSetVisibleTimeStamp.HasValue)
 99                {
 0100                    data.Add("open_duration_ms", (DateTime.Now - exploreSectionSetVisibleTimeStamp.Value).TotalMilliseco
 0101                    exploreSectionSetVisibleTimeStamp = null;
 102                }
 103            }
 104
 0105            GenericAnalytics.SendAnalytic(START_MENU_SECTION_VISIBILITY, data);
 0106        }
 107
 108        public void SendEventTeleport(string eventId, string eventName, bool isWorld, Vector2Int coords, ActionSource so
 109        {
 0110            Dictionary<string, string> data = new Dictionary<string, string>();
 0111            data.Add("event_id", eventId);
 0112            data.Add("event_name", eventName);
 0113            data.Add("isWorld", isWorld.ToString());
 0114            data.Add("event_coords_x", coords.x.ToString());
 0115            data.Add("event_coords_y", coords.y.ToString());
 0116            data.Add("source", source.ToString());
 0117            GenericAnalytics.SendAnalytic(EXPLORE_EVENT_TELEPORT, data);
 0118        }
 119
 120        public void SendParticipateEvent(string eventId, bool isWorld, ActionSource source = ActionSource.FromExplore)
 121        {
 0122            Dictionary<string, string> data = new Dictionary<string, string>();
 0123            data.Add("event_id", eventId);
 0124            data.Add("isWorld", isWorld.ToString());
 0125            data.Add("source", source.ToString());
 0126            GenericAnalytics.SendAnalytic(EXPLORE_PARTICIPATE_EVENT, data);
 0127        }
 128
 129        public void SendRemoveParticipateEvent(string eventId, bool isWorld, ActionSource source = ActionSource.FromExpl
 130        {
 0131            Dictionary<string, string> data = new Dictionary<string, string>();
 0132            data.Add("event_id", eventId);
 0133            data.Add("isWorld", isWorld.ToString());
 0134            data.Add("source", source.ToString());
 0135            GenericAnalytics.SendAnalytic(EXPLORE_REMOVE_PARTICIPATE_EVENT, data);
 0136        }
 137
 138        public void SendClickOnEventInfo(string eventId, string eventName, bool isWorld, int resultPosition = -1, Action
 139        {
 0140            Dictionary<string, string> data = new Dictionary<string, string>();
 0141            data.Add("event_id", eventId);
 0142            data.Add("event_name", eventName);
 0143            data.Add("isWorld", isWorld.ToString());
 0144            data.Add("source", source.ToString());
 0145            data.Add("result_position", resultPosition.ToString());
 0146            GenericAnalytics.SendAnalytic(EXPLORE_CLICK_EVENT_INFO, data);
 0147        }
 148
 149        public void SendPlaceTeleport(string placeId, string placeName, Vector2Int coords, ActionSource source = ActionS
 150        {
 0151            Dictionary<string, string> data = new Dictionary<string, string>();
 0152            data.Add("place_id", placeId);
 0153            data.Add("place_name", placeName);
 0154            data.Add("place_coords_x", coords.x.ToString());
 0155            data.Add("place_coords_y", coords.y.ToString());
 0156            data.Add("source", source.ToString());
 0157            GenericAnalytics.SendAnalytic(EXPLORE_PLACE_TELEPORT, data);
 0158        }
 159
 160        public void SendWorldTeleport(string worldId, string worldName, ActionSource source = ActionSource.FromExplore)
 161        {
 0162            Dictionary<string, string> data = new Dictionary<string, string>();
 0163            data.Add("place_id", worldId);
 0164            data.Add("place_name", worldName);
 0165            data.Add("source", source.ToString());
 0166            GenericAnalytics.SendAnalytic(EXPLORE_WORLD_TELEPORT, data);
 0167        }
 168
 169        public void SendClickOnPlaceInfo(string placeId, string placeName, int resultPosition = -1, ActionSource source 
 170        {
 0171            Dictionary<string, string> data = new Dictionary<string, string>();
 0172            data.Add("place_id", placeId);
 0173            data.Add("place_name", placeName);
 0174            data.Add("source", source.ToString());
 0175            data.Add("result_position", resultPosition.ToString());
 0176            GenericAnalytics.SendAnalytic(EXPLORE_CLICK_PLACE_INFO, data);
 0177        }
 178
 179        public void SendClickOnWorldInfo(string worldId, string worldName, int resultPosition = -1, ActionSource source 
 180        {
 0181            Dictionary<string, string> data = new Dictionary<string, string>();
 0182            data.Add("world_id", worldId);
 0183            data.Add("world_name", worldName);
 0184            data.Add("source", source.ToString());
 0185            data.Add("result_position", resultPosition.ToString());
 0186            GenericAnalytics.SendAnalytic(EXPLORE_CLICK_WORLD_INFO, data);
 0187        }
 188
 189        public void TeleportToPlaceFromFavorite(string placeUUID, string placeName)
 190        {
 0191            var data = new Dictionary<string, string>
 192            {
 193                ["place_id"] = placeUUID,
 194                ["place_name"] = placeName
 195            };
 0196            GenericAnalytics.SendAnalytic(TELEPORT_FAVORITE_PLACE, data);
 0197        }
 198
 199        public void SendSearchEvents(string searchString, Vector2Int[] firstResultsCoordinates, string[] firstResultsIds
 200        {
 0201            var data = new Dictionary<string, string>
 202            {
 203                ["search_string"] = searchString,
 204                ["first_results_coordinates"] = string.Join(",", firstResultsCoordinates),
 205                ["first_results_ids"] = string.Join(",", firstResultsIds)
 206            };
 0207            GenericAnalytics.SendAnalytic(EXPLORE_SEARCH_EVENTS, data);
 0208        }
 209
 210        public void SendSearchPlaces(string searchString, Vector2Int[] firstResultsCoordinates, string[] firstResultsIds
 211        {
 0212            var data = new Dictionary<string, string>
 213            {
 214                ["search_string"] = searchString,
 215                ["first_results_coordinates"] = string.Join(",", firstResultsCoordinates),
 216                ["first_results_ids"] = string.Join(",", firstResultsIds),
 217                ["source"] = source.ToString()
 218            };
 0219            GenericAnalytics.SendAnalytic(EXPLORE_SEARCH_PLACES, data);
 0220        }
 221
 222        public void SendSearchWorlds(string searchString, string[] firstResultsIds)
 223        {
 0224            var data = new Dictionary<string, string>
 225            {
 226                ["search_string"] = searchString,
 227                ["first_results_ids"] = string.Join(",", firstResultsIds)
 228            };
 0229            GenericAnalytics.SendAnalytic(EXPLORE_SEARCH_WORLDS, data);
 0230        }
 231
 232        public void SendPlacesTabOpen()
 233        {
 0234            var data = new Dictionary<string, string>();
 0235            GenericAnalytics.SendAnalytic(EXPLORE_PLACES_TAB_OPEN, data);
 0236        }
 237
 238        public void SendWorldsTabOpen()
 239        {
 0240            var data = new Dictionary<string, string>();
 0241            GenericAnalytics.SendAnalytic(EXPLORE_WORLDS_TAB_OPEN, data);
 0242        }
 243
 244        public void SendEventsTabOpen()
 245        {
 0246            var data = new Dictionary<string, string>();
 0247            GenericAnalytics.SendAnalytic(EXPLORE_EVENTS_TAB_OPEN, data);
 0248        }
 249
 250        public void SendFavoritesTabOpen()
 251        {
 0252            var data = new Dictionary<string, string>();
 0253            GenericAnalytics.SendAnalytic(EXPLORE_FAVORITES_TAB_OPEN, data);
 0254        }
 255
 256        public void SendFilterEvents(FilterType filterType, string filterValue = "")
 257        {
 0258            if (eventTimeFilterTimeStamp == null)
 0259                eventTimeFilterTimeStamp = DateTime.Now;
 260            else
 261            {
 262                // Due to the possible amount of times that we could send this metric, we are setting a min time of 5 se
 0263                if ((DateTime.Now - eventTimeFilterTimeStamp.Value).TotalSeconds <= MIN_TIME_TO_SEND_EVENT_TIME_FILTER_M
 0264                    return;
 265
 0266                eventTimeFilterTimeStamp = null;
 267            }
 268
 0269            var data = new Dictionary<string, string>
 270            {
 271                ["type"] = filterType.ToString(),
 272                ["value"] = filterValue
 273            };
 0274            GenericAnalytics.SendAnalytic(FILTER_EVENTS, data);
 0275        }
 276
 277        public void SendClickedNavmapSearchResult(Vector2Int coordinatesOfResult)
 278        {
 0279            var data = new Dictionary<string, string>
 280            {
 281                ["coordinates_of_result"] = coordinatesOfResult.ToString(),
 282            };
 0283            GenericAnalytics.SendAnalytic(SELECT_NAVMAP_HISTORY_RESULT, data);
 0284        }
 285
 286        public void SendToggleMapLayer(string layerName, bool isActive)
 287        {
 0288            var data = new Dictionary<string, string>
 289            {
 290                ["layer_name"] = layerName,
 291                ["is_active"] = isActive.ToString(),
 292            };
 0293            GenericAnalytics.SendAnalytic(TOGGLE_MAP_LAYER, data);
 0294        }
 295
 296        public void SendOpenGenesisCityUrl() =>
 0297            GenericAnalytics.SendAnalytic(MAP_OPEN_GENESIS_CITY_URL);
 298
 299        public void SendCenterMapToHome() =>
 0300            GenericAnalytics.SendAnalytic(MAP_CENTER_HOME);
 301
 302        public void SendCenterMapToPlayer() =>
 0303            GenericAnalytics.SendAnalytic(MAP_CENTER_TO_PLAYER);
 304    }
 305}

Methods/Properties

SendStartMenuVisibility(System.Boolean, ExploreV2Analytics.ExploreUIVisibilityMethod)
SendStartMenuSectionVisibility(ExploreSection, System.Boolean)
SendEventTeleport(System.String, System.String, System.Boolean, UnityEngine.Vector2Int, ExploreV2Analytics.ActionSource)
SendParticipateEvent(System.String, System.Boolean, ExploreV2Analytics.ActionSource)
SendRemoveParticipateEvent(System.String, System.Boolean, ExploreV2Analytics.ActionSource)
SendClickOnEventInfo(System.String, System.String, System.Boolean, System.Int32, ExploreV2Analytics.ActionSource)
SendPlaceTeleport(System.String, System.String, UnityEngine.Vector2Int, ExploreV2Analytics.ActionSource)
SendWorldTeleport(System.String, System.String, ExploreV2Analytics.ActionSource)
SendClickOnPlaceInfo(System.String, System.String, System.Int32, ExploreV2Analytics.ActionSource)
SendClickOnWorldInfo(System.String, System.String, System.Int32, ExploreV2Analytics.ActionSource)
TeleportToPlaceFromFavorite(System.String, System.String)
SendSearchEvents(System.String, UnityEngine.Vector2Int[], System.String[])
SendSearchPlaces(System.String, UnityEngine.Vector2Int[], System.String[], ExploreV2Analytics.ActionSource)
SendSearchWorlds(System.String, System.String[])
SendPlacesTabOpen()
SendWorldsTabOpen()
SendEventsTabOpen()
SendFavoritesTabOpen()
SendFilterEvents(ExploreV2Analytics.FilterType, System.String)
SendClickedNavmapSearchResult(UnityEngine.Vector2Int)
SendToggleMapLayer(System.String, System.Boolean)
SendOpenGenesisCityUrl()
SendCenterMapToHome()
SendCenterMapToPlayer()