Skip to content

Hooks

SleekTrack fires these hooks for site code. Each is documented by the @api docblock on the apply_filters or do_action call that fires it; a hook without one is internal and may change without notice.

sleekTrack/activated

Action, fired in product/includes/classes/Lifecycle.php.

Fires after SleekTrack is activated on a single site, once the site’s tables exist, the install is registered as its own tracked site and the tracker files are published.

sleekTrack/activatedNetwork

Action, fired in product/includes/classes/Lifecycle.php.

Fires after SleekTrack is network-activated. Network activation provisions no site; each site is enabled from the network admin.

sleekTrack/database/tablesCreated

Action, fired in product/includes/classes/Database/Schema.php.

Fires after SleekTrack creates or upgrades the current site’s events, daily, heatmap and rate-limit tables.

sleekTrack/database/tablesDropped

Action, fired in product/includes/classes/Database/Schema.php.

Fires after SleekTrack drops the current site’s events, daily, heatmap and rate-limit tables when it is uninstalled.

sleekTrack/deactivated

Action, fired in product/includes/classes/Lifecycle.php.

Fires after SleekTrack is deactivated, once its must-use loader, its tracker files and its scheduled tasks are removed. Recorded data is kept.

sleekTrack/group/created

Action, fired in product/includes/classes/Rest/Groups.php.

Fires after a site group is created.

Parameter Type Description
$group array The group with its id, name, color, order and siteCount.

sleekTrack/group/deleted

Action, fired in product/includes/classes/Rest/Groups.php.

Fires after a site group is deleted. Its sites keep their data and become ungrouped.

Parameter Type Description
$group array The group as it was before deletion, with its id, name, color, order and siteCount.

sleekTrack/group/updated

Action, fired in product/includes/classes/Rest/Groups.php.

Fires after a site group’s name, color or order is saved.

Parameter Type Description
$group array The group with its id, name, color, order and siteCount.

sleekTrack/init

Action, fired in product/includes/classes/Plugin.php.

Fires at the end of SleekTrack’s boot on every request, once it has registered its hooks for the request. Code that calls into SleekTrack can start here.

Parameter Type Description
$plugin \SleekTrack\Plugin The module instance, the same one the sleekTrack() function returns.

sleekTrack/network/disabled

Action, fired in product/includes/classes/Network/Manager.php.

Fires in the network admin after SleekTrack is disabled on a network site. Collection stops; the site’s tables and history are kept.

Parameter Type Description
$blogId int The blog ID of the disabled site.

sleekTrack/network/enabled

Action, fired in product/includes/classes/Network/Manager.php.

Fires in the network admin after SleekTrack is enabled on a network site, once that site’s tables exist and it tracks itself.

Parameter Type Description
$blogId int The blog ID of the enabled site.
$siteId int The ID of the tracked site the enabled site registered for itself.

sleekTrack/revenue/baseCurrency

Filter, fired in product/includes/classes/Commerce/Currency.php.

Filters the currency of the headline Revenue figure when neither WooCommerce nor Easy Digital Downloads supplies a store currency. Revenue recorded in any other currency is reported beside it rather than added in.

Parameter Type Description
$currency string A three-letter currency code, USD by default.

Returns string A three-letter currency code.

sleekTrack/site/created

Action, fired in product/includes/classes/Cli/Sites.php, product/includes/classes/Rest/Sites.php.

Fires after a site is added for tracking from the workspace, the REST API or WP-CLI, and when the install registers itself as its own tracked site, which also switches an existing record for its domain back on.

Parameter Type Description
$site array The tracked site with its id, domain, name, is_active, auto_inject, subdomains, group, heatmaps, webhook_url, webhook_secret, token, created_at and updated_at.

sleekTrack/site/deleted

Action, fired in product/includes/classes/Cli/Sites.php, product/includes/classes/Rest/Sites.php.

Fires after a tracked site is deleted together with its recorded events, daily totals and heatmap clicks.

Parameter Type Description
$site array The site as it was before deletion, with the same fields as on sleekTrack/site/created.

sleekTrack/site/updated

Action, fired in product/includes/classes/Cli/Sites.php, product/includes/classes/Rest/Sites.php.

Fires after a tracked site’s settings are saved from the workspace, the REST API or WP-CLI.

Parameter Type Description
$site array The site as stored after the change, with the same fields as on sleekTrack/site/created.

Stay in the Loop!  

Be the first to hear about new updates, special offers, and helpful tips, delivered straight to your inbox.

We respect your inbox (and your privacy). Read our privacy policy.