PHP code example of codexpertio / plugin-tracker-sdk

1. Go to this page and download the library: Download codexpertio/plugin-tracker-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codexpertio / plugin-tracker-sdk example snippets


if ( ! function_exists( 'my_plugin_tracker' ) ) {

	/**
	 * @return object|null The SDK's Tracker, or null when the SDK is not present.
	 */
	function my_plugin_tracker() {
		global $my_plugin_tracker;

		if ( ! isset( $my_plugin_tracker ) ) {
			$my_plugin_tracker = false;

			// Ask the SDK for its own class name rather than naming it here.
			$tracker_autoload = __DIR__ . '/plugin-tracker-sdk/autoload.php';
			$tracker_class    = is_file( $tracker_autoload ) ?  true,     // consent gate 1: you, the author, enable it
					)
				);
			}
		}

		return $my_plugin_tracker ? $my_plugin_tracker : null;
	}

	my_plugin_tracker();
}

// ... your own plugin's bootstrap follows.

$tracker = my_plugin_tracker();

if ( $tracker ) {
	// 'feature' as a bare string, so this line does not name the SDK's namespace either.
	$tracker->track( 'feature', array( 'name' => 'csv_export' ) );
}