< Summary

Class:AnalyticsHelper
Assembly:AnalyticsHelper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/AnalyticsHelper/AnalyticsHelper.cs
Covered lines:11
Uncovered lines:8
Coverable lines:19
Total lines:39
Line coverage:57.8% (11 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AddSceneNameAndBasePositionToDictionary(...)0%2.262060%
SendVoiceChatStartedAnalytic()0%2100%
SendExternalLinkAnalytic(...)0%2.012087.5%
SendExternalLinkAnalytic(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/AnalyticsHelper/AnalyticsHelper.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using DCL;
 4using DCL.Controllers;
 5using UnityEngine;
 6
 7public static class AnalyticsHelper
 8{
 9    public static void AddSceneNameAndBasePositionToDictionary(Dictionary<string, string> analyticDict)
 10    {
 311        string sceneId = Environment.i.world.state.currentSceneId;
 312        if (!string.IsNullOrEmpty(sceneId))
 13        {
 014            analyticDict.Add("parcel", Environment.i.world.state.loadedScenes[sceneId].sceneData.basePosition.x + "," + 
 015            analyticDict.Add("scene", sceneId);
 16        }
 317    }
 18
 19    public static void SendVoiceChatStartedAnalytic()
 20    {
 021        Dictionary<string, string> eventToSend = new Dictionary<string, string>();
 022        AddSceneNameAndBasePositionToDictionary(eventToSend);
 023        IAnalytics analytics = Environment.i.platform.serviceProviders.analytics;
 024        analytics.SendAnalytic("voice_chat_start_recording", eventToSend);
 025    }
 26
 27    public static void SendExternalLinkAnalytic(string url, string nftToken)
 28    {
 329        Dictionary<string, string> eventToSend = new Dictionary<string, string>();
 330        eventToSend.Add("url", url);
 331        if (nftToken != null)
 032            eventToSend.Add("nft_token_id", nftToken);
 333        AddSceneNameAndBasePositionToDictionary(eventToSend);
 334        IAnalytics analytics = Environment.i.platform.serviceProviders.analytics;
 335        analytics.SendAnalytic("external_link_open", eventToSend);
 336    }
 37
 638    public static void SendExternalLinkAnalytic(string url) { SendExternalLinkAnalytic(url, null); }
 39}