#595 initial impl
ad273a47
Michael Schmitz
committed
failed
22 changed files
referrer.ts
/WPE.App.Analytics/wwwroot/referrer.ts+4
/WPE.App.Analytics/wwwroot/referrer.ts
Add comment 1 Plus  export function getReferrer(): string {
Add comment 2 Plus   const url = new URL(document.referrer);
Add comment 3 Plus   return url.origin + url.pathname;
Add comment 4 Plus  }
_Imports.razor
/WPE.App.Analytics/_Imports.razor+2
/WPE.App.Analytics/_Imports.razor
Add comment 1 Plus  @using Microsoft.AspNetCore.Components.Web
Add comment 2 Plus  
IAnalyticsService.cs
/WPE.App.Analytics/IAnalyticsService.cs+66
/WPE.App.Analytics/IAnalyticsService.cs
Add comment 1 Plus  using Infsoft.WPE.DTO.AppConfig;
Add comment 2 Plus  using Infsoft.WPE.DTO.Base;
Add comment 3 Plus  using Microsoft.AspNetCore.Components;
Add comment 4 Plus  using System.Net;
Add comment 5 Plus  
Add comment 6 Plus  namespace Infsoft.WPE.App.Analytics
Add comment 7 Plus  {
Add comment 8 Plus   /// <summary>
Add comment 9 Plus   /// Provides a common interface to send analytic events
Add comment 10 Plus   /// </summary>
Add comment 11 Plus   public interface IAnalyticsService
Add comment 12 Plus   {
Add comment 13 Plus   /// <summary>
Add comment 14 Plus   /// Method to call on startup, to perform necessary initialization
Add comment 15 Plus   /// </summary>
Add comment 16 Plus   Task Init();
Add comment 17 Plus  
Add comment 18 Plus   /// <summary>
Add comment 19 Plus   /// Call this to track a page change
Add comment 20 Plus   /// </summary>
Add comment 21 Plus   /// <param name="title">Page title (e.g. document.title)</param>
Add comment 22 Plus   /// <param name="name">Page name, should never change over time</param>
Add comment 23 Plus   /// <param name="tab">Current app tab (from navbar)</param>
Add comment 24 Plus   /// <param name="lcid">User language</param>
Add comment 25 Plus   /// <param name="env">Environment app is running in</param>
Add comment 26 Plus   /// <param name="user">User mail, <see langword="null"/> when not logged in</param>
Add comment 27 Plus   Task OnPageView(string title, string name, string tab, LanguageId lcid, AppEnvironment env, string? user);
Add comment 28 Plus  
Add comment 29 Plus   /// <summary>
Add comment 30 Plus   /// Call this, when given consent is updated (or on startup)
Add comment 31 Plus   /// </summary>
Add comment 32 Plus   /// <param name="givenConsents">Consents defined and if they are accepted</param>
Add comment 33 Plus   Task OnConsentUpdate(Dictionary<string, bool> givenConsents);
Add comment 34 Plus  
Add comment 35 Plus   /// <summary>
Add comment 36 Plus   /// Register a click on an element
Add comment 37 Plus   /// </summary>
Add comment 38 Plus   /// <param name="name">Name of button, should not change over time</param>
Add comment 39 Plus   /// <param name="text">Displayed text shown to user</param>
Add comment 40 Plus   /// <param name="interactionType">What type of click this belongs to</param>
Add comment 41 Plus   /// <param name="location">Location of button, e.g. NavBar, Tile</param>
Add comment 42 Plus   Task OnClick(string name, string text, InteractionType interactionType, string location);
Add comment 43 Plus  
Add comment 44 Plus   /// <summary>
Add comment 45 Plus   /// Call, when a search is performed
Add comment 46 Plus   /// </summary>
Add comment 47 Plus   /// <param name="numberOfResults">Result count of search</param>
Add comment 48 Plus   /// <param name="searchLocation">Where the search is located, e.g. NavBar, PeopleSearch</param>
Add comment 49 Plus   /// <param name="term">Search term entered by user</param>
Add comment 50 Plus   /// <param name="Filters">Any filters set for properties</param>
Add comment 51 Plus   /// <param name="startingDate">Date restriction for search</param>
Add comment 52 Plus   /// <param name="endDate">End date restriction for search, only set with <paramref name="startingDate"/> set as well</param>
Add comment 53 Plus   Task OnSearch(int numberOfResults, string searchLocation, string? term = null, Dictionary<string, List<string>>? Filters = null, DateTime? startingDate = null, DateTime? endDate = null);
Add comment 54 Plus  
Add comment 55 Plus   /// <summary>
Add comment 56 Plus   /// Call after a successfull interactive login
Add comment 57 Plus   /// </summary>
Add comment 58 Plus   Task OnLogin();
Add comment 59 Plus  
Add comment 60 Plus   /// <summary>
Add comment 61 Plus   /// Call after a successfull silent login
Add comment 62 Plus   /// </summary>
Add comment 63 Plus   Task OnSilentLogin();
Add comment 64 Plus   }
Add comment 65 Plus  }
Add comment 66 Plus  
InteractionType.cs
/WPE.App.Analytics/InteractionType.cs+26
/WPE.App.Analytics/InteractionType.cs
Add comment 1 Plus  namespace Infsoft.WPE.App.Analytics
Add comment 2 Plus  {
Add comment 3 Plus   /// <summary>
Add comment 4 Plus   /// Click interaction types
Add comment 5 Plus   /// </summary>
Add comment 6 Plus   public enum InteractionType
Add comment 7 Plus   {
Add comment 8 Plus   /// <summary>
Add comment 9 Plus   /// Default, any link
Add comment 10 Plus   /// </summary>
Add comment 11 Plus   Link,
Add comment 12 Plus   /// <summary>
Add comment 13 Plus   /// Clicked on a button
Add comment 14 Plus   /// </summary>
Add comment 15 Plus   Button,
Add comment 16 Plus   /// <summary>
Add comment 17 Plus   /// Modified a slider
Add comment 18 Plus   /// </summary>
Add comment 19 Plus   Slider,
Add comment 20 Plus   /// <summary>
Add comment 21 Plus   /// Clicked on search result
Add comment 22 Plus   /// </summary>
Add comment 23 Plus   SearchResult
Add comment 24 Plus   }
Add comment 25 Plus  }
Add comment 26 Plus  
ISiteMetadataService.cs
/WPE.App.Analytics/ISiteMetadataService.cs+23
/WPE.App.Analytics/ISiteMetadataService.cs
Add comment 1 Plus  using System.Net;
Add comment 2 Plus  
Add comment 3 Plus  namespace Infsoft.WPE.App.Analytics
Add comment 4 Plus  {
Add comment 5 Plus   /// <summary>
Add comment 6 Plus   /// Service to get referrer and ip address of page/client
Add comment 7 Plus   /// </summary>
Add comment 8 Plus   public interface ISiteMetadataService
Add comment 9 Plus   {
Add comment 10 Plus   /// <summary>
Add comment 11 Plus   /// Get the HTTP referrer value
Add comment 12 Plus   /// </summary>
Add comment 13 Plus   /// <returns></returns>
Add comment 14 Plus   Task<string> GetReferrer();
Add comment 15 Plus  
Add comment 16 Plus   /// <summary>
Add comment 17 Plus   /// Resolve the current user's ip address
Add comment 18 Plus   /// </summary>
Add comment 19 Plus   /// <returns>IPAdress of user or <see cref="IPAddress.None"/> on failure</returns>
Add comment 20 Plus   Task<IPAddress> GetIPAddress();
Add comment 21 Plus   }
Add comment 22 Plus  }
Add comment 23 Plus  
NoOpAnalyticsService.cs
/WPE.App.Analytics/NoOpAnalyticsService.cs
/WPE.App.Analytics/NoOpAnalyticsService.cs
ServiceCollectionExtensions.cs
/WPE.App.Analytics/ServiceCollectionExtensions.cs
/WPE.App.Analytics/ServiceCollectionExtensions.cs
SiteMetadataService.cs
/WPE.App.Analytics/SiteMetadataService.cs
/WPE.App.Analytics/SiteMetadataService.cs
tsconfig.json
/WPE.App.Analytics/tsconfig.json
/WPE.App.Analytics/tsconfig.json
WPE.App.Analytics.csproj
/WPE.App.Analytics/WPE.App.Analytics.csproj
/WPE.App.Analytics/WPE.App.Analytics.csproj
AppConfiguration.cs
/WPE.App.Analytics.Native/AppConfiguration.cs
/WPE.App.Analytics.Native/AppConfiguration.cs
ILifecycleService.cs
/WPE.App.Analytics.Native/ILifecycleService.cs
/WPE.App.Analytics.Native/ILifecycleService.cs
NoOpLifecycleService.cs
/WPE.App.Analytics.Native/NoOpLifecycleService.cs
/WPE.App.Analytics.Native/NoOpLifecycleService.cs
ServiceCollectionExtensions.cs
/WPE.App.Analytics.Native/ServiceCollectionExtensions.cs
/WPE.App.Analytics.Native/ServiceCollectionExtensions.cs
WPE.App.Analytics.Maui.csproj
/WPE.App.Analytics.Native/WPE.App.Analytics.Maui.csproj
/WPE.App.Analytics.Native/WPE.App.Analytics.Maui.csproj
.gitignore
/.gitignore
/.gitignore
azure-pipelines.yml
/azure-pipelines.yml
/azure-pipelines.yml
icon.png
/icon.png
/icon.png
LICENSE
/LICENSE
/LICENSE
ReadMe.md
/ReadMe.md
/ReadMe.md
version.props
/version.props
/version.props
WPE.App.Analytics.sln
/WPE.App.Analytics.sln
/WPE.App.Analytics.sln