public TrackerSingleton() { var simpleTrackerEnvironment = new SimpleTrackerEnvironment(Environment.OSVersion.Platform.ToString(), Environment.OSVersion.Version.ToString(), Environment.OSVersion.VersionString); this._tracker = new SimpleTracker(GoogleAnalyticsUserAgent, simpleTrackerEnvironment); }
static Analytics() { #if __PC__ if (Settings.Default.GUID == "00000000-0000-0000-0000-000000000000") { Settings.Default.GUID = Guid.NewGuid().ToString(); Settings.Default.Save(); } GUID = Settings.Default.GUID; OperatingSystem os = Environment.OSVersion; trackerEnvironment = new SimpleTrackerEnvironment(os.Platform.ToString(), os.Version.ToString(), os.VersionString); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); AppVersion = MainForm.VERSION; OSVersion = SetWindowsVersion(os.Version.ToString()); bool windowsStoreApp = Application.ExecutablePath.Contains("WindowsApps"); bool debugging = Application.ExecutablePath.Contains("GitRepo"); DeploymentType = windowsStoreApp ? "Windows Store" : debugging ? "Development" : "Zip File"; string resolution = Screen.PrimaryScreen.Bounds.ToString(); #elif __MACOS__ var userDefaults = new NSUserDefaults(); GUID = userDefaults.StringForKey("AnalyticsKey"); if (string.IsNullOrEmpty(GUID)) { GUID = Guid.NewGuid().ToString(); userDefaults.SetString(GUID, "AnalyticsKey"); userDefaults.Synchronize(); } NSProcessInfo info = new NSProcessInfo(); OSVersion = $"MacOSX {info.OperatingSystemVersionString}"; trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); var app = (AppDelegate)NSApplication.SharedApplication.Delegate; AppVersion = FamilyTree.Instance.Version; DeploymentType = "Mac Website"; string resolution = NSScreen.MainScreen.Frame.ToString(); #elif __IOS__ var userDefaults = new NSUserDefaults(); GUID = userDefaults.StringForKey("AnalyticsKey"); if (string.IsNullOrEmpty(GUID)) { GUID = Guid.NewGuid().ToString(); userDefaults.SetString(GUID, "AnalyticsKey"); userDefaults.Synchronize(); } NSProcessInfo info = new NSProcessInfo(); OSVersion = $"MacOSX {info.OperatingSystemVersionString}"; trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion); analyticsSession = new AnalyticsSession(); tracker = new SimpleTracker("UA-125850339-2", analyticsSession, trackerEnvironment); var app = (AppDelegate)UIApplication.SharedApplication.Delegate; AppVersion = FamilyTree.Instance.Version; DeploymentType = "Mac Website"; string resolution = UIScreen.MainScreen.Bounds.ToString(); #endif Resolution = resolution.Length > 11 ? resolution.Substring(9, resolution.Length - 10) : resolution; }
public static async Task Tracker(string pageTitle, string pageUrl) { SimpleTrackerEnvironment ste = new SimpleTrackerEnvironment(Environment.OSVersion.ToString(), Environment.OSVersion.VersionString, ""); using (SimpleTracker tracker = new SimpleTracker("UA-97814311-2", ste)) { await tracker.TrackPageViewAsync(pageTitle, pageUrl, new Dictionary <int, string>()); } }
public static SimpleTracker Get() { if (Tracker == null) { OperatingSystem os = System.Environment.OSVersion; SimpleTrackerEnvironment environment = new SimpleTrackerEnvironment(os.Platform.ToString(), os.Version.ToString(), os.VersionString); Tracker = new SimpleTracker("UA-104211362-5", environment); } return(Tracker); }
static Analytics() { if (Settings.Default.GUID.ToString() == "00000000-0000-0000-0000-000000000000") { Settings.Default.GUID = Guid.NewGuid(); Settings.Default.Save(); } OperatingSystem os = Environment.OSVersion; trackerEnvironment = new SimpleTrackerEnvironment(os.Platform.ToString(), os.Version.ToString(), os.VersionString); tracker = new SimpleTracker("UA-125850339-2", trackerEnvironment); CustomDimensions = new Dictionary <int, string> { }; AppVersion = MainForm.VERSION; }
public static async void TrackFeature(string FeatureCustom) { if (!string.IsNullOrEmpty(_GoogleAnayticsPropertyID)) { SimpleTrackerEnvironment trackerEnvironment = new SimpleTrackerEnvironment(Environment.OSVersion.Platform.ToString(), Environment.OSVersion.Version.ToString(), Environment.OSVersion.VersionString); // Overwrite platform details KeyValuePair <string, string> kvpOSSpecs = GetOperatingSystemProductName(); trackerEnvironment.OsPlatform = kvpOSSpecs.Key; trackerEnvironment.OsVersion = kvpOSSpecs.Value; SimpleTracker tracker = new SimpleTracker(_GoogleAnayticsPropertyID, _Session, trackerEnvironment); await tracker.TrackPageViewAsync(System.AppDomain.CurrentDomain.FriendlyName, FeatureCustom, _CustomDimensions); } }
public Telemetry(IOptions <AppSettings> appSettingsAccessor, AdminAppUserContext userContext, AdminAppDbContext database, IHttpContextAccessor httpContextAccessor, IInferOdsApiVersion inferOdsApiVersion) { _userContext = userContext; _database = database; _httpContextAccessor = httpContextAccessor; _inferOdsApiVersion = inferOdsApiVersion; var appSettings = appSettingsAccessor.Value; _measurementId = appSettings.GoogleAnalyticsMeasurementId; _informationalVersion = Version.InformationalVersion; _environment = new SimpleTrackerEnvironment( OSVersion.Platform.ToString(), OSVersion.Version.ToString(), OSVersion.VersionString ); }
static Analytics() { var userDefaults = new NSUserDefaults(); GUID = userDefaults.StringForKey("AnalyticsKey"); if (string.IsNullOrEmpty(GUID)) { GUID = Guid.NewGuid().ToString(); userDefaults.SetString(GUID, "AnalyticsKey"); userDefaults.Synchronize(); } NSProcessInfo info = new NSProcessInfo(); OSVersion = $"MacOSX {info.OperatingSystemVersionString}"; trackerEnvironment = new SimpleTrackerEnvironment("Mac OSX", info.OperatingSystemVersion.ToString(), OSVersion); tracker = new SimpleTracker("UA-125850339-2", trackerEnvironment); var app = (AppDelegate)NSApplication.SharedApplication.Delegate; AppVersion = app.Version; }