Пример #1
0
        /// <summary>
        /// Specify the streamObjects, otherwise we will count them automatically
        /// </summary>
        /// <param name="speckleApiClient"></param>
        /// <param name="streamObjects"></param>
        public static void StreamReceive(this SpeckleApiClient speckleApiClient, int?streamObjects = null)
        {
            int num_streamObjects = streamObjects ?? speckleApiClient.GetNumberOfObjects();

            MatomoTelemetry.TrackWithMetaMatomo(speckleApiClient, "stream", "receive", "object_num", num_streamObjects.ToString());
            speckleApiClient.TrackWithMetaAppInsights("stream-receive");
            speckleApiClient.TrackWithMetaAmplitude("stream-receive");
        }
Пример #2
0
        public static void Track(this SpeckleApiClient speckleApiClient, string trackName)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }

            speckleApiClient.TrackWithMetaMatomo(trackName, "");
            speckleApiClient.TrackWithMetaAppInsights(trackName);
            speckleApiClient.TrackWithMetaAmplitude(trackName);
        }
Пример #3
0
 public static Dictionary <string, string> GetTrackClientProperties(this SpeckleApiClient speckleApiClient)
 {
     return(new Dictionary <string, string>()
     {
         { "client", speckleApiClient.ClientType },
         { "os_version", TelemetryUtilities.OsVersion },
         { "speckle_version", TelemetryUtilities.SpeckleCoreVersion },
         { "user", speckleApiClient.User._id },
         { "user_is_owner", speckleApiClient.IsStreamOwner() },
     });
 }
Пример #4
0
        public static int GetNumberOfObjects(this SpeckleApiClient speckleApiClient)
        {
            SpeckleStream stream = speckleApiClient.Stream;

            if (stream.Layers != null)
            {
                return((int)stream.Layers.Select(x => x.ObjectCount).Sum());
            }
            else
            {
                return(stream.Objects != null ? stream.Objects.Count : 0);
            }
        }
Пример #5
0
 public static void TrackWithMetaMatomo(this SpeckleApiClient speckleApiClient, string category, string action, string name = "", string value = "")
 {
     if (piwikTracker == null)
     {
         Initialize();
     }
     try
     {
         piwikTracker.SetUserId(TelemetryUtilities.ComputeSHA256Hash(speckleApiClient.User.Email));
         var properties = speckleApiClient.GetTrackClientProperties();
         TrackCustomMatomo(category, action, name, value, properties);
     }
     catch { }
 }
        public static void TrackWithMetaAppInsights(this SpeckleApiClient speckleApiClient, string trackName)
        {
            try
            {
                var metrics = new Dictionary <string, double>()
                {
                    { "object_num", speckleApiClient.GetNumberOfObjects() },
                };

                var properties = speckleApiClient.GetTrackClientProperties();

                TrackCustomAppInsights(trackName, metrics, properties);
            }
            catch { }
        }
Пример #7
0
        public static void TrackWithMetaAmplitude(this SpeckleApiClient speckleApiClient, string trackName)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }

            try
            {
                var properties = speckleApiClient.GetTrackClientProperties();
                properties.Add("object_num", speckleApiClient.GetNumberOfObjects().ToString());
                var user_email = TelemetryUtilities.ComputeSHA256Hash(speckleApiClient.User.Email);
                TrackAmplitudeAsync(requestUri, api_key, user_email, properties, trackName);
            }
            catch { }
        }
Пример #8
0
    // Initialise receiver
    public async void Init(string StreamId, string URL)
    {
        Client = new SpeckleCore.SpeckleApiClient(URL);

        // Assign events
        Client.OnReady     += Client_OnReady;
        Client.OnLogData   += Client_OnLogData;
        Client.OnWsMessage += Client_OnWsMessage;
        Client.OnError     += Client_OnError;

        SpeckleObjects = new List <SpeckleCore.SpeckleObject>();

        await Client.IntializeReceiver(StreamId, Application.productName, "Unity", Application.buildGUID, authToken);

        Client.Stream = (await Client.StreamGetAsync(Client.StreamId, null)).Resource;

        rootGameObject = new GameObject(Client.Stream.Name);

        // Call event on SpeckleManager to allow users to do their own thing when a stream is created
        transform.GetComponent <UnitySpeckle>().OnReceiverCreated.Invoke(this);

        UpdateGlobal();
    }
Пример #9
0
        // It is only kept for the notes
        public static void AddCustomParametersFromSpeckle(this PiwikTracker piwikTracker, SpeckleApiClient speckleApiClient)
        {
            piwikTracker.SetUserAgent(TelemetryUtilities.UserAgent);

            piwikTracker.SetCustomTrackingParameter("client", speckleApiClient.ClientType);
            // Here are some variations that are suggested from the docs in order to track custom dimensions.
            // Will need to came back and clean-up here once we know how this works
            piwikTracker.SetCustomTrackingParameter("dimension1", speckleApiClient.ClientType);
            piwikTracker.SetCustomTrackingParameter("dimension2", TelemetryUtilities.OsVersion);
            piwikTracker.SetCustomTrackingParameter("os_version", TelemetryUtilities.OsVersion);
            piwikTracker.SetCustomTrackingParameter("speckle_version", TelemetryUtilities.SpeckleCoreVersion);
            piwikTracker.SetCustomTrackingParameter("user", speckleApiClient.User._id);
            piwikTracker.SetCustomTrackingParameter("user_is_owner", speckleApiClient.User._id == speckleApiClient.Stream.Owner ? "True" : "False");
            // Not sure if we need the line below for tracking custom Dimensions.
            // or the one we are calling after this method is enough: piwikTracker.DoTrackEvent(category, action, name, value);
            //piwikTracker.DoTrackPageView("Record Metadata");
        }
Пример #10
0
 public static string IsStreamOwner(this SpeckleApiClient speckleApiClient)
 {
     return(speckleApiClient.User._id == speckleApiClient.Stream.Owner ? "True" : "False");
 }