DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AnalyticsService

    Service for managing analytics goals.

    Inheritance
    object
    AnalyticsService
    Implements
    IAnalyticsService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Analytics
    Assembly: DataWeb.Core.dll
    Syntax
    public class AnalyticsService : IAnalyticsService
    Remarks

    Initializes a new instance of the AnalyticsService class.

    Constructors

    AnalyticsService(IHttpService, IAnalyticsGoalStore, TimeProvider, IStringLocalizer)

    Service for managing analytics goals.

    Declaration
    public AnalyticsService(IHttpService httpService, IAnalyticsGoalStore goalStore, TimeProvider timeProvider, IStringLocalizer localizer)
    Parameters
    Type Name Description
    IHttpService httpService
    IAnalyticsGoalStore goalStore
    TimeProvider timeProvider
    IStringLocalizer localizer
    Remarks

    Initializes a new instance of the AnalyticsService class.

    Methods

    GetGoalAsync(AnalyticsGoalFilter, CancellationToken)

    Gets an analytics goal matching the specified filter.

    Declaration
    public Task<AnalyticsGoal> GetGoalAsync(AnalyticsGoalFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AnalyticsGoalFilter filter

    The AnalyticsGoalFilter to use when querying for the goal.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<AnalyticsGoal>

    An analytics goal matching the specified filter.

    GetGoalCountAsync(AnalyticsGoalFilter, CancellationToken)

    Gets the count of analytics goals matching the specified filter.

    Declaration
    public Task<long> GetGoalCountAsync(AnalyticsGoalFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AnalyticsGoalFilter filter

    The AnalyticsGoalFilter to use when counting goals.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<long>

    The count of analytics goals matching the specified filter.

    GetGoalTotalValueAsync(AnalyticsGoalFilter, CancellationToken)

    Gets the total value of analytics goals matching the specified filter.

    Declaration
    public Task<decimal> GetGoalTotalValueAsync(AnalyticsGoalFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AnalyticsGoalFilter filter

    The AnalyticsGoalFilter to use when calculating the total value of goals.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<decimal>

    The total value of analytics goals matching the specified filter.

    GetGoalsAsync(AnalyticsGoalFilter, CancellationToken)

    Gets a collection of AnalyticsGoal objects that match the specified AnalyticsGoalFilter.

    Declaration
    public Task<IEnumerable<AnalyticsGoal>> GetGoalsAsync(AnalyticsGoalFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AnalyticsGoalFilter filter

    The AnalyticsGoalFilter used to search for goals.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task<IEnumerable<AnalyticsGoal>>

    A collection of AnalyticsGoal objects.

    GetPeriodData(string, DateTime?, DateTime?)

    Gets the period data for a given period mode and optional start and end dates.

    Declaration
    public virtual PeriodData GetPeriodData(string periodMode, DateTime? periodDateStart = null, DateTime? periodDateEnd = null)
    Parameters
    Type Name Description
    string periodMode

    The period mode as a string (e.g. "Today", "CurrentWeek", "CurrentMonth", etc.).

    DateTime? periodDateStart

    Optional start date for custom period mode.

    DateTime? periodDateEnd

    Optional end date for custom period mode.

    Returns
    Type Description
    PeriodData

    A PeriodData object containing the period data, including start and end dates, aggregation mode, and description.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when periodMode is null or empty.

    ArgumentException

    Thrown when periodMode is Custom but dates are not provided, periodDateStart > periodDateEnd, or periodMode is unknown.

    GetPeriodModes()

    Gets a list of period modes.

    Declaration
    public virtual List<List.ListItem> GetPeriodModes()
    Returns
    Type Description
    List<List.ListItem>

    A list of List.ListItem objects representing the available period modes.

    GetStartOfWeek(DateTime, DayOfWeek)

    Gets the start date of the week that contains the given date, based on the specified starting day of the week.

    Declaration
    public static DateTime GetStartOfWeek(DateTime date, DayOfWeek startOfWeek)
    Parameters
    Type Name Description
    DateTime date

    The date for which to find the start of the week.

    DayOfWeek startOfWeek

    The day of the week that represents the start of the week (e.g. DayOfWeek.Monday).

    Returns
    Type Description
    DateTime

    A DateTime object representing the start date of the week.

    SetGoalAsync(AnalyticsGoal, CancellationToken)

    Sets an analytics goal.

    Declaration
    public Task SetGoalAsync(AnalyticsGoal goal, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AnalyticsGoal goal

    The AnalyticsGoal to set.

    CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    Task
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when goal is null.

    Implements

    IAnalyticsService
    In this article
    Back to top Generated by DocFX