wpdesk / wp-wpdesk-tracker-deactivation
1.5.2
2022-08-30 08:43 UTC
Requires
- php: >=5.6
Requires (Dev)
- 10up/wp_mock: *
- mockery/mockery: *
- phpunit/phpunit: <7
- squizlabs/php_codesniffer: ^3.0.2
- wimg/php-compatibility: ^8
- wp-coding-standards/wpcs: ^0.14.1
- wpdesk/wp-builder: ^1.4|^2.0
- wpdesk/wp-wpdesk-tracker: ^2.0|^3.0
README
Deactivation Tracker
A WordPress Library containing interfaces, abstracts and implementations to be used for plugin deactivations data tracking.
Requirements
PHP 7.0 or later.
Installation via Composer
In order to install the bindings via Composer run the following command:
composer require wpdesk/wp-wpdesk-tracker-deactivation
Example usage
Creating deactivation tracker
The following code creates deactivation tracker. Once the site admin deactivates the plugin, a pop-up containing the deactivation reasons will appear. Right after the relevant deactivation reason is selected, the site admin's response will be sent to the tracker server.
$deactivation_tracker = \WPDesk\Tracker\Deactivation\TrackerFactory::createDefaultTracker(
'my-beautiful-plugin',
'my-beautiful-plugin/my-beautiful-plugin.php',
__( 'My Beautiful Plugin' )
);
$deactivation_tracker->hooks();
Replacing the default sender
class MySender implements WPDesk_Tracker_Sender {
public function send_payload(array $payload){
// implement send_payload method.
}
}
$plugin_slug = 'my-example-plugin';
add_filter( 'wpdesk/tracker/sender/' . $plugin_slug, 'replace_sender' );
function replace_sender() {
return new MySender();
}