Appsero - Client


You can install Appsero Client in two ways, via composer and manually.

1. Composer Installation

Add dependency in your project (theme/plugin):

composer require appsero/client

Now add autoload.php in your file if you haven't done already.

require __DIR__ . '/vendor/autoload.php';

2. Manual Installation

Clone the repository in your project.

cd /path/to/your/project/folder
git clone appsero

Now include the dependencies in your plugin/theme.

require __DIR__ . '/appsero/src/Client.php';


Appsero can be used in both themes and plugins.

The Appsero\Client class has three parameters:

$insights = new Appsero\Client( $hash, $name, $file );
  • hash (string, required) - The unique identifier for a plugin or theme.
  • name (string, required) - The name of the plugin or theme.
  • file (string, required) - The main file path of the plugin. For theme, path to functions.php

Usage Example

Please refer to the installation step before start using the class.

You can obtain the hash for your plugin for the Appsero Dashboard. The 3rd parameter must have to be the main file of the plugin.

 * Initialize the tracker
 * @return void
function appsero_init_tracker_appsero_test() {

    if ( ! class_exists( 'Appsero\Client' ) ) {
      require_once __DIR__ . '/appsero/src/Client.php';

    $client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044891', 'Akismet', __FILE__ );

    // Active insights

    // Active automatic updater

    // Active license page and checker
    $args = array(
        'type'       => 'options',
        'menu_title' => 'Akismet',
        'page_title' => 'Akismet License Settings',
        'menu_slug'  => 'akismet_settings',
    $client->license()->add_settings_page( $args );


For plugins example code that needs to be used on your main plugin file. For themes example code that needs to be used on your themes functions.php file.

More Usage

Sometimes you wouldn't want to show the notice or want to customize the notice message. You can do that as well.

$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );

1. Hiding the notice


2. Customizing the notice message

       ->notice( 'My Custom Notice Message' )

3. Adding extra data

You can add extra metadata from your theme or plugin. In that case, the keys has to be whitelisted from the Appsero dashboard.

$metadata = array(
    'key'     => 'value',
    'another' => 'another_value'
       ->add_extra( $metadata )

Dynamic Usage

In some cases you wouldn't want to show the optin message, but forcefully opt-in the user and send tracking data.

$client = new Appsero\Client( 'a4a8da5b-b419-4656-98e9-4a42e9044892', 'Twenty Twelve', __FILE__ );

$insights = $client->insights();

// somewhere in your code, opt-in the user forcefully
// execute this only once