| | 1 | | using DCL; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using static DCL.SettingsCommon.GeneralSettings; |
| | 4 | |
|
| | 5 | | namespace SocialFeaturesAnalytics |
| | 6 | | { |
| | 7 | | public class SocialAnalytics : ISocialAnalytics |
| | 8 | | { |
| | 9 | | private const string PLAYER_MUTED = "user_muted"; |
| | 10 | | private const string PLAYER_UNMUTED = "user_unmuted"; |
| | 11 | | private const string VOICE_MESSAGE_STARTED_BY_FIRST_TIME = "voice_chat_start_recording"; |
| | 12 | | private const string VOICE_MESSAGE_SENT = "voice_message_sent"; |
| | 13 | | private const string VOICE_CHANNEL_CONNECTION = "voice_channel_connection"; |
| | 14 | | private const string VOICE_CHANNEL_DISCONNECTION = "voice_channel_disconnection"; |
| | 15 | | private const string VOICE_CHAT_PREFERENCES_CHANGED = "voice_chat_preferences_changed"; |
| | 16 | | private const string FRIEND_REQUEST_SENT = "friend_request_sent"; |
| | 17 | | private const string FRIEND_REQUEST_APPROVED = "friend_request_approved"; |
| | 18 | | private const string FRIEND_REQUEST_REJECTED = "friend_request_rejected"; |
| | 19 | | private const string FRIEND_REQUEST_CANCELLED = "friend_request_cancelled"; |
| | 20 | | private const string FRIEND_REQUEST_ERROR = "friend_request_error"; |
| | 21 | | private const string FRIEND_DELETED = "friend_deleted"; |
| | 22 | | private const string PASSPORT_OPENED = "passport_opened"; |
| | 23 | | private const string PASSPORT_CLOSED = "passport_closed"; |
| | 24 | | private const string PASSPORT_CLICKED_ON_COLLECTIONS = "passport_collections_click"; |
| | 25 | | private const string PASSPORT_STARTED_CONVERSATION = "passport_started_conversation"; |
| | 26 | | private const string PASSPORT_INSPECT_AVATAR = "passport_inspect_avatar"; |
| | 27 | | private const string PASSPORT_CLICK_LINK = "passport_clicked_link"; |
| | 28 | | private const string PASSPORT_WALLET_COPY = "passport_wallet_copy"; |
| | 29 | | private const string PASSPORT_USERNAME_COPY = "passport_username_copy"; |
| | 30 | | private const string PASSPORT_JUMP_IN = "passport_jump_in"; |
| | 31 | | private const string PASSPORT_EDIT_PROFILE = "passport_edit_profile"; |
| | 32 | | private const string PASSPORT_BUY_NFT = "passport_buy_nft"; |
| | 33 | | private const string PLAYER_BLOCKED = "user_blocked"; |
| | 34 | | private const string PLAYER_UNBLOCKED = "user_unblocked"; |
| | 35 | | private const string PLAYER_REPORT = "player_report"; |
| | 36 | | private const string PLAYER_JOIN = "player_join"; |
| | 37 | | private const string PLAY_EMOTE = "used_emote"; |
| | 38 | | private const string EMPTY_CHANNEL_CREATED = "chat_channel_created"; |
| | 39 | | private const string POPULATED_CHANNEL_JOINED = "player_joins_channel"; |
| | 40 | | private const string CHANNEL_LEAVE = "player_leaves_channel"; |
| | 41 | | private const string CHANNEL_SEARCH = "player_search_channel"; |
| | 42 | | private const string CHANNEL_LINK_CLICK = "player_clicks_channel_link"; |
| | 43 | | private const string MENTION_MESSAGE_SENT = "mention_message_sent"; |
| | 44 | | private const string MENTION_CLICKED = "mention_clicked"; |
| | 45 | | private const string MENTION_CREATED = "mention_created"; |
| | 46 | |
|
| 310 | 47 | | public static SocialAnalytics i { get; private set; } |
| | 48 | |
|
| | 49 | | private readonly IAnalytics analytics; |
| | 50 | | private readonly IUserProfileBridge userProfileBridge; |
| | 51 | |
|
| 309 | 52 | | public SocialAnalytics(IAnalytics analytics, IUserProfileBridge userProfileBridge) |
| | 53 | | { |
| 309 | 54 | | this.analytics = analytics; |
| 309 | 55 | | this.userProfileBridge = userProfileBridge; |
| 309 | 56 | | i ??= this; |
| 309 | 57 | | } |
| | 58 | |
|
| | 59 | | public void SendPlayerMuted(string toUserId) |
| | 60 | | { |
| 0 | 61 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 62 | |
|
| 0 | 63 | | if (toPlayerType == null) |
| 0 | 64 | | return; |
| | 65 | |
|
| 0 | 66 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 67 | | { { "to", toPlayerType.ToString() } }; |
| | 68 | |
|
| 0 | 69 | | analytics.SendAnalytic(PLAYER_MUTED, data); |
| 0 | 70 | | } |
| | 71 | |
|
| | 72 | | public void SendPlayerUnmuted(string toUserId) |
| | 73 | | { |
| 0 | 74 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 75 | |
|
| 0 | 76 | | if (toPlayerType == null) |
| 0 | 77 | | return; |
| | 78 | |
|
| 0 | 79 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 80 | | { { "to", toPlayerType.ToString() } }; |
| | 81 | |
|
| 0 | 82 | | analytics.SendAnalytic(PLAYER_UNMUTED, data); |
| 0 | 83 | | } |
| | 84 | |
|
| | 85 | | public void SendVoiceMessageStartedByFirstTime() |
| | 86 | | { |
| 0 | 87 | | analytics.SendAnalytic(VOICE_MESSAGE_STARTED_BY_FIRST_TIME, new Dictionary<string, string>()); |
| 0 | 88 | | } |
| | 89 | |
|
| | 90 | | public void SendVoiceMessage(double messageLength, VoiceMessageSource source, string fromUserId) |
| | 91 | | { |
| 0 | 92 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| | 93 | |
|
| 0 | 94 | | if (fromPlayerType == null) |
| 0 | 95 | | return; |
| | 96 | |
|
| 0 | 97 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 98 | | { |
| | 99 | | { "from", fromPlayerType.ToString() }, |
| | 100 | | { "length", messageLength.ToString() }, |
| | 101 | | { "source", source.ToString() }, |
| | 102 | | }; |
| | 103 | |
|
| 0 | 104 | | analytics.SendAnalytic(VOICE_MESSAGE_SENT, data); |
| 0 | 105 | | } |
| | 106 | |
|
| | 107 | | public void SendVoiceChannelConnection(int numberOfPeers) |
| | 108 | | { |
| 0 | 109 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 110 | | { { "numberOfPeers", numberOfPeers.ToString() } }; |
| | 111 | |
|
| 0 | 112 | | analytics.SendAnalytic(VOICE_CHANNEL_CONNECTION, data); |
| 0 | 113 | | } |
| | 114 | |
|
| | 115 | | public void SendVoiceChannelDisconnection() |
| | 116 | | { |
| 0 | 117 | | analytics.SendAnalytic(VOICE_CHANNEL_DISCONNECTION, new Dictionary<string, string>()); |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | public void SendClickedOnCollectibles() |
| | 121 | | { |
| 0 | 122 | | analytics.SendAnalytic(PASSPORT_CLICKED_ON_COLLECTIONS, new Dictionary<string, string>()); |
| 0 | 123 | | } |
| | 124 | |
|
| | 125 | | public void SendStartedConversation(PlayerActionSource source, string recipientId) |
| | 126 | | { |
| 0 | 127 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 128 | | { |
| | 129 | | { "source", source.ToString() }, |
| | 130 | | { "receiver_wallet_id", recipientId }, |
| | 131 | | }; |
| | 132 | |
|
| 0 | 133 | | analytics.SendAnalytic(PASSPORT_STARTED_CONVERSATION, data); |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | public void SendNftBuy(PlayerActionSource source) |
| | 137 | | { |
| 0 | 138 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 139 | | { { "source", source.ToString() } }; |
| | 140 | |
|
| 0 | 141 | | analytics.SendAnalytic(PASSPORT_BUY_NFT, data); |
| 0 | 142 | | } |
| | 143 | |
|
| | 144 | | public void SendInspectAvatar(double timeSpent) |
| | 145 | | { |
| 0 | 146 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 147 | | { { "timeSpent", timeSpent.ToString() } }; |
| | 148 | |
|
| 0 | 149 | | analytics.SendAnalytic(PASSPORT_INSPECT_AVATAR, data); |
| 0 | 150 | | } |
| | 151 | |
|
| | 152 | | public void SendLinkClick(PlayerActionSource source) |
| | 153 | | { |
| 0 | 154 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 155 | | { { "source", source.ToString() } }; |
| | 156 | |
|
| 0 | 157 | | analytics.SendAnalytic(PASSPORT_CLICK_LINK, data); |
| 0 | 158 | | } |
| | 159 | |
|
| | 160 | | public void SendCopyWallet(PlayerActionSource source) |
| | 161 | | { |
| 0 | 162 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 163 | | { { "source", source.ToString() } }; |
| | 164 | |
|
| 0 | 165 | | analytics.SendAnalytic(PASSPORT_WALLET_COPY, data); |
| 0 | 166 | | } |
| | 167 | |
|
| | 168 | | public void SendCopyUsername(PlayerActionSource source) |
| | 169 | | { |
| 0 | 170 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 171 | | { { "source", source.ToString() } }; |
| | 172 | |
|
| 0 | 173 | | analytics.SendAnalytic(PASSPORT_USERNAME_COPY, data); |
| 0 | 174 | | } |
| | 175 | |
|
| | 176 | | public void SendJumpInToPlayer(PlayerActionSource source, string recipientId) |
| | 177 | | { |
| 0 | 178 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 179 | | { |
| | 180 | | { "source", source.ToString() }, |
| | 181 | | { "receiver_wallet_id", recipientId }, |
| | 182 | | }; |
| | 183 | |
|
| 0 | 184 | | analytics.SendAnalytic(PASSPORT_JUMP_IN, data); |
| 0 | 185 | | } |
| | 186 | |
|
| | 187 | | public void SendProfileEdit(int descriptionLength, bool hasLinks, PlayerActionSource source, ProfileField fieldC |
| | 188 | | { |
| 0 | 189 | | var data = new Dictionary<string, string> |
| | 190 | | { |
| | 191 | | { "source", source.ToString() }, |
| | 192 | | { "descriptionLength", descriptionLength.ToString() }, |
| | 193 | | { "hasLinks", hasLinks.ToString() }, |
| | 194 | | { "field", fieldChanged.ToString() }, |
| | 195 | | }; |
| | 196 | |
|
| 0 | 197 | | analytics.SendAnalytic(PASSPORT_EDIT_PROFILE, data); |
| 0 | 198 | | } |
| | 199 | |
|
| | 200 | | public void SendVoiceChatPreferencesChanged(VoiceChatAllow preference) |
| | 201 | | { |
| 0 | 202 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 203 | | { { "allow", preference.ToString() } }; |
| | 204 | |
|
| 0 | 205 | | analytics.SendAnalytic(VOICE_CHAT_PREFERENCES_CHANGED, data); |
| 0 | 206 | | } |
| | 207 | |
|
| | 208 | | public void SendFriendRequestError(string senderId, string recipientId, string source, string errorDescription, |
| | 209 | | { |
| 0 | 210 | | var data = new Dictionary<string, string> |
| | 211 | | { |
| | 212 | | { "source", source }, |
| | 213 | | { "description", errorDescription }, |
| | 214 | | { "senderId", senderId }, |
| | 215 | | { "receiverId", recipientId }, |
| | 216 | | { "friendRequestId", friendRequestId }, |
| | 217 | | }; |
| | 218 | |
|
| 0 | 219 | | analytics.SendAnalytic(FRIEND_REQUEST_ERROR, data); |
| 0 | 220 | | } |
| | 221 | |
|
| | 222 | | public void SendFriendRequestSent(string fromUserId, string toUserId, double messageLength, PlayerActionSource s |
| | 223 | | { |
| 0 | 224 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| 0 | 225 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 226 | |
|
| 0 | 227 | | if (fromPlayerType == null || toPlayerType == null) |
| 0 | 228 | | return; |
| | 229 | |
|
| 0 | 230 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 231 | | { |
| | 232 | | { "from", fromPlayerType.ToString() }, |
| | 233 | | { "to ", toPlayerType.ToString() }, |
| | 234 | |
|
| | 235 | | // TODO (FRIEND REQUESTS): retro-compatibility, remove this param in the future |
| | 236 | | { "text_length", messageLength.ToString() }, |
| | 237 | | { "attached_message_length", messageLength.ToString() }, |
| | 238 | | { "attached_message", messageLength > 0 ? "true" : "false" }, |
| | 239 | | { "source", source.ToString() }, |
| | 240 | | { "senderId", fromUserId }, |
| | 241 | | { "receiverId", toUserId }, |
| | 242 | | { "friendRequestId", friendRequestId }, |
| | 243 | | }; |
| | 244 | |
|
| 0 | 245 | | analytics.SendAnalytic(FRIEND_REQUEST_SENT, data); |
| 0 | 246 | | } |
| | 247 | |
|
| | 248 | | public void SendFriendRequestApproved(string fromUserId, string toUserId, string source, bool hasBodyMessage, st |
| | 249 | | { |
| 0 | 250 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| 0 | 251 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 252 | |
|
| 0 | 253 | | if (fromPlayerType == null || toPlayerType == null) |
| 0 | 254 | | return; |
| | 255 | |
|
| 0 | 256 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 257 | | { |
| | 258 | | { "from", fromPlayerType.ToString() }, |
| | 259 | | { "to", toPlayerType.ToString() }, |
| | 260 | | { "source", source }, |
| | 261 | | { "has_body_message", hasBodyMessage ? "true" : "false" }, |
| | 262 | | { "friendRequestId", friendRequestId }, |
| | 263 | | { "senderId", fromUserId }, |
| | 264 | | { "receiverId", toUserId }, |
| | 265 | | }; |
| | 266 | |
|
| 0 | 267 | | analytics.SendAnalytic(FRIEND_REQUEST_APPROVED, data); |
| 0 | 268 | | } |
| | 269 | |
|
| | 270 | | public void SendFriendRequestRejected(string fromUserId, string toUserId, string source, bool hasBodyMessage, st |
| | 271 | | { |
| 0 | 272 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| 0 | 273 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 274 | |
|
| 0 | 275 | | if (fromPlayerType == null || toPlayerType == null) |
| 0 | 276 | | return; |
| | 277 | |
|
| 0 | 278 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 279 | | { |
| | 280 | | { "from", fromPlayerType.ToString() }, |
| | 281 | | { "to", toPlayerType.ToString() }, |
| | 282 | | { "source", source }, |
| | 283 | | { "has_body_message", hasBodyMessage ? "true" : "false" }, |
| | 284 | | { "senderId", fromUserId }, |
| | 285 | | { "receiverId", toUserId }, |
| | 286 | | { "friendRequestId", friendRequestId }, |
| | 287 | | }; |
| | 288 | |
|
| 0 | 289 | | analytics.SendAnalytic(FRIEND_REQUEST_REJECTED, data); |
| 0 | 290 | | } |
| | 291 | |
|
| | 292 | | public void SendFriendRequestCancelled(string fromUserId, string toUserId, string source, string friendRequestId |
| | 293 | | { |
| 0 | 294 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| 0 | 295 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 296 | |
|
| 0 | 297 | | if (fromPlayerType == null || toPlayerType == null) |
| 0 | 298 | | return; |
| | 299 | |
|
| 0 | 300 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 301 | | { |
| | 302 | | { "from", fromPlayerType.ToString() }, |
| | 303 | | { "to", toPlayerType.ToString() }, |
| | 304 | | { "source", source }, |
| | 305 | | { "friendRequestId", friendRequestId }, |
| | 306 | | { "senderId", fromUserId }, |
| | 307 | | { "receiverId", toUserId }, |
| | 308 | | }; |
| | 309 | |
|
| 0 | 310 | | analytics.SendAnalytic(FRIEND_REQUEST_CANCELLED, data); |
| 0 | 311 | | } |
| | 312 | |
|
| | 313 | | public void SendFriendDeleted(string fromUserId, string toUserId, PlayerActionSource source) |
| | 314 | | { |
| 0 | 315 | | PlayerType? fromPlayerType = GetPlayerTypeByUserId(fromUserId); |
| 0 | 316 | | PlayerType? toPlayerType = GetPlayerTypeByUserId(toUserId); |
| | 317 | |
|
| 0 | 318 | | if (fromPlayerType == null || toPlayerType == null) |
| 0 | 319 | | return; |
| | 320 | |
|
| 0 | 321 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 322 | | { |
| | 323 | | { "from", fromPlayerType.ToString() }, |
| | 324 | | { "to", toPlayerType.ToString() }, |
| | 325 | | { "source", source.ToString() }, |
| | 326 | | { "senderId", fromUserId }, |
| | 327 | | { "receiverId", toUserId }, |
| | 328 | | }; |
| | 329 | |
|
| 0 | 330 | | analytics.SendAnalytic(FRIEND_DELETED, data); |
| 0 | 331 | | } |
| | 332 | |
|
| | 333 | | public void SendMessageWithMention(string recipientId) |
| | 334 | | { |
| 0 | 335 | | analytics.SendAnalytic(MENTION_MESSAGE_SENT, new Dictionary<string, string> |
| | 336 | | { |
| | 337 | | { "receiver_wallet_id", recipientId }, |
| | 338 | | }); |
| 0 | 339 | | } |
| | 340 | |
|
| | 341 | | public void SendClickedMention(string recipientId) |
| | 342 | | { |
| 0 | 343 | | analytics.SendAnalytic(MENTION_CLICKED, new Dictionary<string, string> |
| | 344 | | { |
| | 345 | | { "receiver_wallet_id", recipientId }, |
| | 346 | | }); |
| 0 | 347 | | } |
| | 348 | |
|
| | 349 | | public void SendMentionCreated(MentionCreationSource source, string recipientId) |
| | 350 | | { |
| 0 | 351 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 352 | | { |
| | 353 | | { "source", source.ToString() }, |
| | 354 | | { "receiver_wallet_id", recipientId }, |
| | 355 | | }; |
| | 356 | |
|
| 0 | 357 | | analytics.SendAnalytic(MENTION_CREATED, data); |
| 0 | 358 | | } |
| | 359 | |
|
| | 360 | | public void SendPassportOpen(string recipientId, bool found = true, AvatarOpenSource source = AvatarOpenSource.W |
| | 361 | | { |
| 0 | 362 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 363 | | { |
| | 364 | | { "source", source.ToString() }, |
| | 365 | | { "found", found.ToString() }, |
| | 366 | | { "receiver_wallet_id", recipientId }, |
| | 367 | | }; |
| | 368 | |
|
| 0 | 369 | | analytics.SendAnalytic(PASSPORT_OPENED, data); |
| 0 | 370 | | } |
| | 371 | |
|
| | 372 | | public void SendPassportClose(string recipientId, double timeSpent) |
| | 373 | | { |
| 0 | 374 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 375 | | { |
| | 376 | | { "time_spent", timeSpent.ToString() }, |
| | 377 | | { "receiver_wallet_id", recipientId }, |
| | 378 | | }; |
| | 379 | |
|
| 0 | 380 | | analytics.SendAnalytic(PASSPORT_CLOSED, data); |
| 0 | 381 | | } |
| | 382 | |
|
| | 383 | | public void SendPlayerBlocked(bool isFriend, PlayerActionSource source, string recipientId) |
| | 384 | | { |
| 0 | 385 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 386 | | { |
| | 387 | | { "friend", isFriend.ToString() }, |
| | 388 | | { "source", source.ToString() }, |
| | 389 | | { "receiver_wallet_id", recipientId }, |
| | 390 | | }; |
| | 391 | |
|
| 0 | 392 | | analytics.SendAnalytic(PLAYER_BLOCKED, data); |
| 0 | 393 | | } |
| | 394 | |
|
| | 395 | | public void SendPlayerUnblocked(bool isFriend, PlayerActionSource source, string recipientId) |
| | 396 | | { |
| 0 | 397 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 398 | | { |
| | 399 | | { "friend", isFriend.ToString() }, |
| | 400 | | { "source", source.ToString() }, |
| | 401 | | { "receiver_wallet_id", recipientId }, |
| | 402 | | }; |
| | 403 | |
|
| 0 | 404 | | analytics.SendAnalytic(PLAYER_UNBLOCKED, data); |
| 0 | 405 | | } |
| | 406 | |
|
| | 407 | | public void SendPlayerReport(PlayerReportIssueType issueType, double messageLength, PlayerActionSource source, s |
| | 408 | | { |
| 0 | 409 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 410 | | { |
| | 411 | | { "issue_type", issueType.ToString() }, |
| | 412 | | { "text_length", messageLength.ToString() }, |
| | 413 | | { "source", source.ToString() }, |
| | 414 | | { "receiver_wallet_id", recipientId }, |
| | 415 | | }; |
| | 416 | |
|
| 0 | 417 | | analytics.SendAnalytic(PLAYER_REPORT, data); |
| 0 | 418 | | } |
| | 419 | |
|
| | 420 | | public void SendPlayerJoin(PlayerActionSource source, string recipientId) |
| | 421 | | { |
| 0 | 422 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 423 | | { |
| | 424 | | { "source", source.ToString() }, |
| | 425 | | { "receiver_wallet_id", recipientId }, |
| | 426 | | }; |
| | 427 | |
|
| 0 | 428 | | analytics.SendAnalytic(PLAYER_JOIN, data); |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | public void SendPlayEmote(string emoteId, string emoteName, string rarity, bool isBaseEmote, UserProfile.EmoteSo |
| | 432 | | string parcelLocation) |
| | 433 | | { |
| 0 | 434 | | Dictionary<string, string> data = new Dictionary<string, string> |
| | 435 | | { |
| | 436 | | { "id", emoteId }, |
| | 437 | | { "name", emoteName }, |
| | 438 | | { "rarity", rarity }, |
| | 439 | | { "isBase", isBaseEmote.ToString() }, |
| | 440 | | { "source", source.ToString() }, |
| | 441 | | { "parcel_location", parcelLocation }, |
| | 442 | | }; |
| | 443 | |
|
| 0 | 444 | | analytics.SendAnalytic(PLAY_EMOTE, data); |
| 0 | 445 | | } |
| | 446 | |
|
| | 447 | | public void SendEmptyChannelCreated(string channelName, ChannelJoinedSource source) |
| | 448 | | { |
| 0 | 449 | | string command = source switch |
| | 450 | | { |
| 0 | 451 | | ChannelJoinedSource.Command => "command", |
| 0 | 452 | | ChannelJoinedSource.Link => "link", |
| 0 | 453 | | ChannelJoinedSource.Search => "create_search", |
| 0 | 454 | | _ => "" |
| | 455 | | }; |
| | 456 | |
|
| 0 | 457 | | var data = new Dictionary<string, string> |
| | 458 | | { |
| | 459 | | { "source", command }, |
| | 460 | | { "channel", channelName }, |
| | 461 | | }; |
| | 462 | |
|
| 0 | 463 | | analytics.SendAnalytic(EMPTY_CHANNEL_CREATED, data); |
| 0 | 464 | | } |
| | 465 | |
|
| | 466 | | public void SendPopulatedChannelJoined(string channelName, ChannelJoinedSource source, string method) |
| | 467 | | { |
| 0 | 468 | | string conversationList = source switch |
| | 469 | | { |
| 0 | 470 | | ChannelJoinedSource.Command => "command", |
| 0 | 471 | | ChannelJoinedSource.Link => "link", |
| 0 | 472 | | ChannelJoinedSource.Search => "search", |
| 0 | 473 | | ChannelJoinedSource.ConversationList => "conversation_list", |
| 0 | 474 | | _ => "" |
| | 475 | | }; |
| | 476 | |
|
| 0 | 477 | | var data = new Dictionary<string, string> |
| | 478 | | { |
| | 479 | | { "source", conversationList }, |
| | 480 | | { "channel", channelName }, |
| | 481 | | { "method", method }, |
| | 482 | | }; |
| | 483 | |
|
| 0 | 484 | | analytics.SendAnalytic(POPULATED_CHANNEL_JOINED, data); |
| 0 | 485 | | } |
| | 486 | |
|
| | 487 | | public void SendLeaveChannel(string channelId, ChannelLeaveSource source) |
| | 488 | | { |
| 0 | 489 | | string conversationList = source switch |
| | 490 | | { |
| 0 | 491 | | ChannelLeaveSource.Chat => "chat", |
| 0 | 492 | | ChannelLeaveSource.Command => "command", |
| 0 | 493 | | ChannelLeaveSource.Search => "search", |
| 0 | 494 | | ChannelLeaveSource.ConversationList => "conversation_list", |
| 0 | 495 | | _ => "" |
| | 496 | | }; |
| | 497 | |
|
| 0 | 498 | | var data = new Dictionary<string, string> |
| | 499 | | { |
| | 500 | | { "source", conversationList }, |
| | 501 | | { "channel", channelId }, |
| | 502 | | }; |
| | 503 | |
|
| 0 | 504 | | analytics.SendAnalytic(CHANNEL_LEAVE, data); |
| 0 | 505 | | } |
| | 506 | |
|
| | 507 | | public void SendChannelSearch(string text) |
| | 508 | | { |
| 0 | 509 | | var data = new Dictionary<string, string> |
| | 510 | | { { "search", text } }; |
| | 511 | |
|
| 0 | 512 | | analytics.SendAnalytic(CHANNEL_SEARCH, data); |
| 0 | 513 | | } |
| | 514 | |
|
| | 515 | | public void SendChannelLinkClicked(string channel, bool joinAccepted, ChannelLinkSource source) |
| | 516 | | { |
| 0 | 517 | | string profile = source switch |
| | 518 | | { |
| 0 | 519 | | ChannelLinkSource.Chat => "chat", |
| 0 | 520 | | ChannelLinkSource.Event => "event", |
| 0 | 521 | | ChannelLinkSource.Place => "place", |
| 0 | 522 | | ChannelLinkSource.Profile => "profile", |
| 0 | 523 | | _ => "" |
| | 524 | | }; |
| | 525 | |
|
| 0 | 526 | | var data = new Dictionary<string, string> |
| | 527 | | { |
| | 528 | | { "source", profile }, |
| | 529 | | { "channel", channel }, |
| | 530 | | { "result", joinAccepted ? "joined" : "cancel" }, |
| | 531 | | }; |
| | 532 | |
|
| 0 | 533 | | analytics.SendAnalytic(CHANNEL_LINK_CLICK, data); |
| 0 | 534 | | } |
| | 535 | |
|
| | 536 | | private PlayerType? GetPlayerTypeByUserId(string userId) |
| | 537 | | { |
| 0 | 538 | | if (string.IsNullOrEmpty(userId)) |
| 0 | 539 | | return null; |
| | 540 | |
|
| 0 | 541 | | UserProfile userProfile = userProfileBridge.Get(userId); |
| | 542 | |
|
| 0 | 543 | | if (userProfile == null) |
| 0 | 544 | | return null; |
| | 545 | |
|
| 0 | 546 | | return userProfile.isGuest ? PlayerType.Guest : PlayerType.Wallet; |
| | 547 | | } |
| | 548 | | } |
| | 549 | | } |