1. Home
  2. Documentation
  3. Selling with Freemius
  4. Integration & Configuration

Integration & Configuration

Integrating the Freemius SDK into your product is a quick step you need to complete in order to be able to take advantage of all the benefits that come with using Freemius.

Here’s how to do it:

After logging in to your Freemius account and clicking on the blinking ‘ADD PLUGIN / THEME’ button at the top left hand corner you will be able to provide some basic settings for your product:

Upon hitting the ‘Create New’ button your data is saved and you are then redirected to the 5-minute integration guide. After completing these instructions your product will be all set up and ready to sell.

The first step is to download the ZIP file which contains the Freemius SDK that contains all of the Freemius magic inside it. You can download the latest release from our GitHub repository, then unzip, rename it to ‘freemius’ and copy it into your product’s main folder.

With the Freemius SDK folder included in your product’s main folder you can complete the quick customization process according to the instructions on the integration guide.

When you’re done – your customized ‘easy SDK access’ function will be auto-generated for you.

For WordPress plugins, copy & paste it into the top of your main plugin’s PHP file, right after the plugin’s header comment and if ( ! defined( 'ABSPATH' ) ) exit; check.

For WordPress themes, copy & paste it into the top of your theme’s functions.php file.

Here’s how the code should look like:

// Create a helper function for easy SDK access.
function my_fs() {
    global $my_fs;

    if ( ! isset( $my_fs ) ) {
        // Include Freemius SDK.
        require_once dirname(__FILE__) . '/freemius/start.php';

        $my_fs = fs_dynamic_init( array(
            'id'                => '132',
            'slug'              => 'my-plugin-slug',
            'type'              => 'plugin',
            'public_key'        => 'pk_5a17fa37bb479f1f2858d228aa81d',
            'is_premium'        => true,
            'is_premium_only'   => true,
            'has_addons'        => false,
            'has_paid_plans'    => true,
            'menu'              => array(
            ),
            // Set the SDK to work in a sandbox mode (for development & testing).
            // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
            'secret_key'  => 'sk_2APhM2Jil[r130:;{#Ar{C5L5zGP&',
        ) );
    }

    return $my_fs;
}

// Init Freemius.
my_fs();

After that you can go back to the WordPress admin and activate & opt-in to your product (plugin or theme), and if everything was done correctly you should be able to see the data flowing into your Freemius dashboard in real time.