Sitewide_Tracker
Builds stable context keys for front-end requests that do not have a post ID.
Site-wide visits are stored in the shared Top 10 count tables under one of the fixed numeric IDs defined by Sitewide_Database. Context IDs are shared across sites; the count tables keep each site’s values separate by blog_id.
Namespace: WebberZone\Top_Ten\Pro
Since: 4.5.0
Source: includes/pro/class-sitewide-tracker.php line 23
Methods
get_context_for_tracker() static
Provide the site-wide context to the shared tracker.
Since: 4.5.0
Line: 33
static public function get_context_for_tracker( $context = ... ): string;
| Type | Name | Description |
|---|---|---|
string |
$context |
Existing context value. |
Returns: string — Site-wide context, or an empty string when disabled.
update_count() static
Record a site-wide view through the shared tracker extension point.
Since: 4.5.0
Line: 51
static public function update_count( $result, $context, $blog_id, $activate_counter, $source = ... ): string;
| Type | Name | Description |
|---|---|---|
string |
$result |
Existing tracker response. |
string |
$context |
Site-wide context key. |
int |
$blog_id |
Blog ID. |
int |
$activate_counter |
Counter flag. |
int |
$source |
Traffic source. |
Returns: string — Tracker response.
is_enabled() static
Determine whether the Pro site-wide tracker is enabled.
Since: 4.5.0
Line: 73
static public function is_enabled( ): bool;
Returns: bool — True when the setting is enabled.
get_context() static
Get a normalized context for the current front-end request.
Most singular requests intentionally return an empty context because they are already tracked by their real post ID. The front page is checked first so a static front page can also contribute to the site-wide aggregate. Archive variants are intentionally grouped by type (for example, all searches use the search ID and all category archives use the category ID).
Since: 4.5.0
Line: 105
static public function get_context( ): string;
Returns: string — Context key, or an empty string when it should not track.
normalize_context() static
Normalize a context key before it is sent to a tracker endpoint.
Since: 4.5.0
Line: 164
static public function normalize_context( $context ): string;
| Type | Name | Description |
|---|---|---|
string |
$context |
Raw context key. |
Returns: string — Normalized context key.