Cms\Classes\TrafficLogger

Overview

TrafficLogger logs pageviews for Internal Traffic Statistics.


Public Methods

public static getRetentionMonths()

public static getRetentionMonths(): int|null 

getRetentionMonths returns data retention, in months. Returns the number of months or null for indefinite retention.

public static getTimezone()

public static getTimezone(): string 

getTimezone retrieves the timezone setting for the Internal Traffic Statistics feature. If no specific timezone is set for the feature, it defaults to the general CMS timezone. Returns the timezone identifier string.

public static isEnabled()

public static isEnabled(): bool 

isEnabled checks if the Internal Traffic Statistics feature is enabled. Returns true if the feature is enabled, and false otherwise.

public static logPageview()

public static logPageview(): void

logPageview logs a pageview for the Internal Traffic Statistics. This method should be called whenever a page is viewed to keep the statistics up-to-date. Creates a client ID cookie if it doesn't exist.

Protected Methods

protected static generateClientId()

protected static generateClientId(): string 

generateClientId generates a random client ID string.

protected static getClientId()

protected static getClientId(): void

getClientId retrieves the client ID from the cookie.

protected static isUserAuthenticated()

protected static isUserAuthenticated(): bool 

isUserAuthenticated checks if the user is currently authenticated. Returns true if the user is authenticated, and false otherwise.

protected static makeEventDateTime()

protected static makeEventDateTime(): Carbon\Carbon 

makeEventDateTime returns the current event date and time in the configured timezone. Returns the event date and time string.