Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

1.6 KB
Raw Blame
using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Localization;

namespace Widgets.GoogleAnalytics;

/// <summary>
///     Live person provider
/// </summary>
public class GoogleAnalyticProvider : IWidgetProvider
{
    private readonly GoogleAnalyticsEcommerceSettings _googleAnalyticsEcommerceSettings;
    private readonly ITranslationService _translationService;

    public GoogleAnalyticProvider(
        ITranslationService translationService,
        GoogleAnalyticsEcommerceSettings googleAnalyticsEcommerceSettings)
    {
        _translationService = translationService;
        _googleAnalyticsEcommerceSettings = googleAnalyticsEcommerceSettings;
    }

    public string ConfigurationUrl => GoogleAnalyticDefaults.ConfigurationUrl;

    public string SystemName => GoogleAnalyticDefaults.ProviderSystemName;

    public string FriendlyName => _translationService.GetResource(GoogleAnalyticDefaults.FriendlyName);

    public int Priority => _googleAnalyticsEcommerceSettings.DisplayOrder;

    public IList<string> LimitedToStores => new List<string>();

    public IList<string> LimitedToGroups => new List<string>();

    /// <summary>
    ///     Gets widget zones where this widget should be rendered
    /// </summary>
    /// <returns>Widget zones</returns>
    public async Task<IList<string>> GetWidgetZones()
    {
        return await Task.FromResult(new List<string> {
            "body_end_html_tag_before", "clean_body_end_html_tag_before"
        });
    }

    public Task<string> GetPublicViewComponentName(string widgetZone)
    {
        return Task.FromResult("WidgetsGoogleAnalytics");
    }
}