Example #1
0
        static void Main(string[] args)
        {
            PiwikTracker _piwikTracker   = new PiwikTracker(SiteId, PiwikBaseUrl);
            string       _version        = args[0];
            string       _internalDomain = args[1];
            string       _machineName    = Environment.MachineName.ToLower(new CultureInfo("en-GB", false));
            string       _domainName     = Dns.GetHostEntry("").HostName;
            string       _appDataFolder  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            // If the cache has been set up this is an update, otherwise it's a new user
            string _installType = File.Exists(_appDataFolder + CacheLocation) ? "update" : "new";

            bool _isInternalDomain = _machineName.Contains(_internalDomain) || _domainName.Contains(_internalDomain);

            // Don't collect telemetry except for users on the internal domain.
            LocalContext.SetTelemetrySettings(_isInternalDomain);

            if (_isInternalDomain)
            {
                // Hash the username and send it with the installer info
                _piwikTracker.SetUserId(ComputeSHA256Hash(Environment.UserName + "@" + _internalDomain + ".com"));

                // Send this information to Matomo
                _piwikTracker.DoTrackEvent("SpeckleAutoCADInstaller", _installType, _version);
            }
        }