Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Google Analytics Configurator #452

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

Bram1903
Copy link
Collaborator

As requested in #451, users now have the ability to configure whether they want to use Google Analytics or not. By default, Google Analytics is disabled, and users can enable it through the appsettings.json.

The PrivacySettings class has been modified to support this feature with the following properties:

  • UseGoogleAnalytics: A boolean that indicates whether Google Analytics should be enabled (true) or not (false).
  • GoogleAnalyticsKey: A nullable string that holds the Google Analytics key when UseGoogleAnalytics is set to true. When Google Analytics is disabled, this property can be empty.

These changes allow users to have better control over Google Analytics integration, ensuring their privacy preferences are respected.

Updated configuration section:

"PrivacySettings": {
    "LogClientIpAddresses": true,
    "LogClientAgents": true,
    "UseGoogleAnalytics": false,
    "GoogleAnalyticsKey": ""
  },

Updated PrivacySettings class:

/// <summary>
///     Represents the privacy settings for the application.
/// </summary>
public class PrivacySettings
{
    /// <summary>
    ///     Gets the unique key to identify the PrivacySettings configuration.
    /// </summary>
    public const string Key = nameof(PrivacySettings);

    /// <summary>
    ///     Gets or sets a value indicating whether the client IP addresses should be logged.
    /// </summary>
    public bool LogClientIpAddresses { get; set; } = true;

    /// <summary>
    ///     Gets or sets a value indicating whether the client agents (user agents) should be logged.
    /// </summary>
    public bool LogClientAgents { get; set; } = true;

    /// <summary>
    ///     Gets or sets a value indicating whether Google Analytics should be used for tracking.
    /// </summary>
    public bool UseGoogleAnalytics { get; set; }

    /// <summary>
    ///     Gets or sets the Google Analytics tracking key.
    /// </summary>
    /// <remarks>
    ///     If <see cref="UseGoogleAnalytics" /> is set to true, this property must contain a valid Google Analytics tracking
    ///     key.
    /// </remarks>
    public string? GoogleAnalyticsKey { get; set; }
}

@Bram1903 Bram1903 added the Enhancement New feature or request label Jul 21, 2023
@Bram1903 Bram1903 requested a review from neozhu July 21, 2023 07:42
@Bram1903 Bram1903 self-assigned this Jul 21, 2023
@Bram1903 Bram1903 mentioned this pull request Jul 21, 2023
Copy link
Owner

@neozhu neozhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Bram1903
Copy link
Collaborator Author

Bram1903 commented Jul 21, 2023

@neozhu, let's wait for the checks to finish before we merge the code.

I updated the CleanArchitecture.Blazor.nuspec just now as well. Can you quickly check if everything is alright before we merge this pull request?

@neozhu neozhu merged commit bf7ef16 into neozhu:main Jul 21, 2023
3 checks passed
@Bram1903 Bram1903 linked an issue Jul 21, 2023 that may be closed by this pull request
@Bram1903 Bram1903 deleted the GoogleAnalyticsConfigurator branch July 21, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Analytics
2 participants