BCards/src/BCards.Web/Models/PageAnalytics.cs
2025-06-24 23:25:02 -03:00

30 lines
925 B
C#

using MongoDB.Bson.Serialization.Attributes;
namespace BCards.Web.Models;
public class PageAnalytics
{
[BsonElement("totalViews")]
public int TotalViews { get; set; } = 0;
[BsonElement("totalClicks")]
public int TotalClicks { get; set; } = 0;
[BsonElement("lastViewedAt")]
public DateTime? LastViewedAt { get; set; }
[BsonElement("monthlyViews")]
public Dictionary<string, int> MonthlyViews { get; set; } = new(); // "2024-01" -> count
[BsonElement("monthlyClicks")]
public Dictionary<string, int> MonthlyClicks { get; set; } = new();
[BsonElement("topReferrers")]
public Dictionary<string, int> TopReferrers { get; set; } = new();
[BsonElement("deviceStats")]
public Dictionary<string, int> DeviceStats { get; set; } = new(); // mobile, desktop, tablet
[BsonElement("countryStats")]
public Dictionary<string, int> CountryStats { get; set; } = new();
}