{"id":21947929,"url":"https://github.com/tinystuff/tinyinsights","last_synced_at":"2025-04-22T14:48:02.652Z","repository":{"id":24793795,"uuid":"102461679","full_name":"TinyStuff/TinyInsights","owner":"TinyStuff","description":"The idea behind TinyInsights is to build a cross platform library to use with your favorite Analytics provider. Right now there are providers for AppCenter, Application Insights, and Google Analytics. And you are of course welcome to contribute with your favorite provider.","archived":false,"fork":false,"pushed_at":"2024-09-26T17:38:40.000Z","size":450,"stargazers_count":35,"open_issues_count":3,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-21T06:21:59.694Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TinyStuff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-05T09:25:07.000Z","updated_at":"2024-09-26T17:38:43.000Z","dependencies_parsed_at":"2024-11-13T20:33:29.882Z","dependency_job_id":"403e54d9-c38f-4b3c-a627-a511e97c43d9","html_url":"https://github.com/TinyStuff/TinyInsights","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinyStuff%2FTinyInsights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinyStuff%2FTinyInsights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinyStuff%2FTinyInsights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TinyStuff%2FTinyInsights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TinyStuff","download_url":"https://codeload.github.com/TinyStuff/TinyInsights/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250262934,"owners_count":21401769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T05:10:41.748Z","updated_at":"2025-04-22T14:48:02.627Z","avatar_url":"https://github.com/TinyStuff.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TinyInsights\nFor .NET MAUI, go to: https://github.com/dhindrik/TinyInsights.Maui\n\n\n## Build status\n\u003cimg src=\"https://io2gamelabs.visualstudio.com/_apis/public/build/definitions/be16d002-5786-41a1-bf3b-3e13d5e80aa0/8/badge\" alt=\"build status\" /\u003e\n\n## About\nThe idea behind TinyInsights is to build a cross platform library to use with your favorite Analytics provider. Right now there are a providers for AppCenter, Application Insights and Google Analytics. And you are of course welcome to contribute with your favorite provider.\n\n## Release notes\n1.1 - Introducing an Application Insigts provider and a new method for tracking dependencies. Read more in this blog post, https://danielhindrikes.se/index.php/2020/03/10/application-insights-for-xamarin-and-uwp-apps-with-tinyinsights/\n\n## Get started\nInstall the Nuget package for the provider you want to use in the platform project, in other projects use the TinyInsights package.\n\n\nFor Microsoft AppCenter install the package TinyInsights.AppCenter.\n\n```\nÌnstall-Package TinyInsights.AppCenter\n```\n\nFor Azure ApplicationInsights install the package TinyInsights.ApplicationInsights.\n\n```\nÌnstall-Package TinyInsights.ApplicationInsights\n```\n\nIf you have more projects in yout solution and want to use TinyInsights in them, you can install just the TinyInsights package. The \"provider package\" is just needed in the procject handling the configuration.\n\n```\nÌnstall-Package TinyInsights\n```\n\n### Configure TinyInsights\n```csharp\nvar appCenterProvider = new AppCenterProvider(iOSKey, AndroidKey, UWPKey)\n\nTinyInsights.Configure(appCenterProvider);\n```\n\nWhen multiple providers will be available you can use them simultaneously, just  use configure for all of the providers.\n\n```csharp\nvar appInsightsProvider = new ApplicationInsightsProvider(\"{InstrumentationKey}\");\n\nTinyInsights.Configure(appCenterProvider, appInsightsProvider);\n```\n\nIf you have multiple providers you can configure what to track with each provider. By default everything is tracked.\n```csharp\nappCenterProvider.IsTrackPageViewsEnabled = false;\nappCenterProvider.IsTrackEventsEnabled = false;\nappCenterProvider.IsTrackDependencyEnabled = false;\n\nappInsightsProvider.IsTrackErrorsEnabled = false;\n```\n\n### Track errors\n\n```csharp\ncatch(Ecception ex)\n{\n     await TinyInsights.TrackErrorAsync(ex);\n}\n\n//with properties\nvar properties = new  Dictionarty\u003cstring, string\u003e();\nproperties.Add(\"MyFirstProperty\", \"MyFirstValue\");\nproperties.Add(\"MySecondProperty\", \"MySeconndValue\");\n\ncatch(Ecception ex)\n{\n     await TinyInsights.TrackErrorAsync(ex, properties);\n}\n```\n\n### Track page views\n```csharp\nawait TinyInsights.TrackPageViewAsync(\"SuperCoolView\");\n\n//with properties\nvar properties = new  Dictionarty\u003cstring, string\u003e();\nproperties.Add(\"MyFirstProperty\", \"MyFirstValue\");\nproperties.Add(\"MySecondProperty\", \"MySeconndValue\");\n\nawait TinyInsights.TrackPageViewAsync(\"SuperCoolView\", properties);\n```\n\n### Track custom events\n```csharp\nawait TinyInsights.TrackEventAsync(\"SuperCoolEvent\");\n\n//with properties\nvar properties = new  Dictionarty\u003cstring, string\u003e();\nproperties.Add(\"MyFirstProperty\", \"MyFirstValue\");\nproperties.Add(\"MySecondProperty\", \"MySeconndValue\");\n\nawait TinyInsights.TrackEventAsync(\"SuperCoolEvent\", properties);\n```\n\n### Track dependencies\nThere are a two of ways to track dependencies with TinyInsights.\nThe first and the basic method is \u003cstrong\u003eTrackDependencyAsync\u003c/strong\u003e, and is also used in the background by the other way to do it.\n\n```csharp\nvar startTime = DateTimeOffset.Now;\n\nvar success = await GetData();\n\nvar duration = DateTimeOffset.Now - startTime\n\nawait TinyInsights.TrackDependencyAsync(\"api.mydomain.se\", \"https://api/mydomain.se/v1/data/get\", startTime, duration, success);\n```\n\nThe second way is to create a TinyDependency object that handles most of the tracking for you. You will do that by just by wrapping your code for the dependency in a using statement. \n```csharp\nusing (var tracker = TinyInsights.CreateDependencyTracker(\"api.mydomain.se\", \"https://api/mydomain.se/v1/data/get\"))\n{\n     await GetData();\n}\n```\n\nIf the dependency succeded that is fine, but if it not you need to handle that on your own, using the \u003cstrong\u003eFinish\u003c/strong\u003e method of the TinyDependency object.\n```csharp\nusing (var tracker = TinyInsights.CreateDependencyTracker(\"api.mydomain.se\", \"https://api/mydomain.se/v1/data/get\"))\n{\n     try\n     {\n          var repsonse = await GetData();\n     \n          if(!response.IsSuccessStatusCode)\n          {\n               await tracker.Finish(false, (int)response.StatusCode);\n          }\n     }\n     catch(Exception ex)\n     {\n          tracker.Finish(false, ex);\n     }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinystuff%2Ftinyinsights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinystuff%2Ftinyinsights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinystuff%2Ftinyinsights/lists"}