예제 #1
0
        public static void TrackCustomMatomo(string category, string action, string name = "", string value = "", Dictionary <string, string> properties = null)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }
            try
            {
                if (piwikTracker == null)
                {
                    Initialize();
                }

                piwikTracker.SetUserAgent(TelemetryUtilities.UserAgent);

                if (properties != null)
                {
                    foreach (var prop in properties)
                    {
                        piwikTracker.SetCustomTrackingParameter(prop.Key, prop.Value);
                    }
                }
                piwikTracker.DoTrackEvent(category, action, name, value);
            }
            catch { }
        }
        public static void TrackCustomAppInsights(string trackName, Dictionary <string, double> metrics, Dictionary <string, string> properties)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }

            try
            {
                var            telemetryClient = TelemetryClient;
                EventTelemetry telemetry       = new EventTelemetry();
                telemetry.Name = trackName;

                foreach (var prop in properties)
                {
                    telemetry.Properties.Add(prop);
                }

                foreach (var metric in metrics)
                {
                    telemetry.Metrics.Add(metric);
                }

                telemetryClient.TrackEvent(telemetry);
            }
            catch { }
        }
예제 #3
0
        public static void TrackCustomAmplitude(string trackName, string user_id, Dictionary <string, string> user_properties)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }

            TrackAmplitudeAsync(requestUri, api_key, user_id, user_properties, event_type: trackName);
        }
예제 #4
0
 public static void TrackCustom(string trackName, Dictionary <string, double> metrics, Dictionary <string, string> properties)
 {
     if (!LocalContext.GetTelemetrySettings())
     {
         return;
     }
     AppInsightsTelemetry.TrackCustomAppInsights(trackName, metrics, properties);
     MatomoTelemetry.TrackCustomMatomo(trackName, "", "", "", properties);
     AmplitudeTelemetry.TrackCustomAmplitude(trackName, TelemetryUtilities.UserAgent, properties);
 }
예제 #5
0
        public static void Track(this SpeckleApiClient speckleApiClient, string trackName)
        {
            if (!LocalContext.GetTelemetrySettings())
            {
                return;
            }

            speckleApiClient.TrackWithMetaMatomo(trackName, "");
            speckleApiClient.TrackWithMetaAppInsights(trackName);
            speckleApiClient.TrackWithMetaAmplitude(trackName);
        }
예제 #6
0
        public static void RecordTestEvent(string clientType)
        {
            Initialize();

            if (LocalContext.GetTelemetrySettings() == false)
            {
                return;
            }

            var segmentation = GetSegmentation(clientType);
            var test         = Countly.RecordEvent("test-event", 1, segmentation).Result;
        }
예제 #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
        public static void RecordStreamUpdated(string clientType)
        {
            Initialize();

            if (LocalContext.GetTelemetrySettings() == false)
            {
                return;
            }

            Task.Run(() =>
            {
                try
                {
                    Countly.RecordEvent("stream-updated", 1, GetSegmentation(clientType));
                }
                catch { }
            });
        }
예제 #9
0
        public static void Initialize( )
        {
            if (isInitialized)
            {
                return;
            }

            if (LocalContext.GetTelemetrySettings() == false)
            {
                return;
            }
            try
            {
                DeviceId = new DeviceIdBuilder()
                           .AddMachineName()
                           .AddProcessorId()
                           .UseFormatter(new HashDeviceIdFormatter(() => SHA256.Create(), new Base64UrlByteArrayEncoder()))
                           .ToString();

                var config = new CountlyConfig()
                {
                    serverUrl                 = "https://telemetry.speckle.works",
                    appKey                    = "cd6db5058036aafb6a3a82681d434ad74ee50ad9",
                    deviceIdMethod            = Countly.DeviceIdMethod.developerSupplied,
                    developerProvidedDeviceId = DeviceId
                };

                Countly.IsLoggingEnabled = true;
                Countly.Instance.Init(config);
                Countly.Instance.RecordView("speckle-init");
                Countly.Instance.RecordView("speckle-init/version/" + typeof(SpeckleTelemetry).Assembly.GetName().Version);

                isInitialized = true;
            }catch (Exception e)
            {
                // POKEMON
                isInitialized = false;
            }
        }