Tracker
Tracks post views via the tracker endpoint and its AJAX handlers.
Namespace: WebberZone\Top_Ten
Since: 3.3.0
Source: includes/class-tracker.php line 23
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 30
public function __construct( );
enqueue_scripts() static
Enqueues the scripts needed by Top 10.
Since: 1.9.7
Line: 44
static public function enqueue_scripts( ): void;
Returns: void
query_vars() static
Function to add additional queries to query_vars.
Since: 2.0.0
Line: 176
static public function query_vars( $vars ): array;
| Type | Name | Description |
|---|---|---|
array |
$vars |
Query variables array. |
Returns: array — Query variables array with Top 10 parameters appended
parse_request() static
Parses the WordPress object to update/display the count.
Since: 2.0.0
Line: 203
static public function parse_request( $wp );
| Type | Name | Description |
|---|---|---|
\WP |
$wp |
Current WordPress environment instance. |
add_feed_tracker() static
Add a tracking pixel to feed content.
Feed readers that block remote images by default will not trigger the count.
Since: 4.3.0
Line: 278
static public function add_feed_tracker( $content ): string;
| Type | Name | Description |
|---|---|---|
string |
$content |
Feed content. |
Returns: string — Feed content with the tracker image appended.
tracker_parser() static
Parse the ajax response.
Since: 2.4.0
Line: 347
static public function tracker_parser( );
is_tracking_request_allowed() static
Check whether a tracker request should be processed.
Cached pages can enqueue the tracker for a bot, so bot detection must also run at the endpoint. Browser prefetches and direct navigations must not create views.
Since: 4.5.0
Line: 391
static public function is_tracking_request_allowed( ): bool;
Returns: bool — True when the request may be tracked.
update_count() static
Function to update the count in the database.
Since: 2.6.0
Line: 424
static public function update_count( $id, $blog_id, $activate_counter, $source = ... ): string;
| Type | Name | Description |
|---|---|---|
int |
$id |
Post ID. |
int |
$blog_id |
Blog ID. |
int |
$activate_counter |
Activate counter flag. |
int |
$source |
Traffic source: 0 = web, 1 = feed. |
Returns: string — Response on database update.
update_sitewide_count() static
Update a site-wide context count.
Line: 469
static public function update_sitewide_count( $context, $blog_id, $activate_counter, $source = ... ): string;
| Type | Name | Description |
|---|---|---|
string |
$context |
Context key. |
int |
$blog_id |
Blog ID. |
int |
$activate_counter |
Counter flag. |
int |
$source |
Traffic source. |
Returns: string — Response on database update.