NAV
  • PHP SDK
  • PHP SDK

    Introduction

    Welcome to the developer documentation for the Kameleoon PHP SDK! Our SDK gives you the possibility of running experiments and activating feature flags on your back-end PHP server. Integrating our SDK into your web-application is easy, and its footprint (in terms of memory and network usage) is low.

    You can refer to the SDK reference to check out all possible features of the SDK. Also make sure you check out our Getting started tutorial which we have prepared to walk you through the installation and implementation.

    Latest version of the PHP SDK: 2.0.4.

    Getting started

    This guide is designed to help you integrate our SDK in a few minutes and start running experiments in your PHP applications. This tutorial will explain the setup of a simple A/B test to change the number of recommended products based on different variations.

    Creating an experiment

    First, you must create an experiment in the Kameleoon back-office so that our platform is aware of the new A/B test you're planning to implement on your side. Make sure that server-side type is chosen as shown below:

    Server-side experiment

    Upon successful creation of the experiment, you will need to get its ID to use in the SDK as an argument to the triggerExperiment() method.

    Installing the SDK

    You should install our SDK by downloading it from this link. Once uncompressed, you will see two directories: kameleoon/ and job/.

    Installing the PHP client (Composer package)

    The kameleoon/ directory corresponds to the PHP package itself, which should be used with the Composer dependency manager. Install this directory in your composer hierarchy (so you should have vendor/kameleoon/client/src). Then edit composer.json and add a Kameleoon entry:

    "autoload": {
        "psr-4": {
            "Kameleoon\\": "vendor/kameleoon/client/src"
        }
    }
    

    Finally, execute the following command to regenerate the autoloader:

    composer dump-autoload -o

    Installing the cron job

    The job/ directory corresponds to a job that must be executed via a standard job scheduler (like cron). We suggest to install the script itself to /usr/local/opt/kameleoon/kameleoon-client-php-process-queries.sh and to use our default supplied crontab entry. But you can install it in another location and modify the crontab entry accordingly.

    Additional configuration

    You can customize the behavior of the PHP SDK via a configuration file. We provide a sample configuration file named client-php.json.sample in the SDK archive. We suggest to install this file to the default path of /etc/kameleoon/client-php.json. With the current version of the PHP SDK, 6 keys are available:

    Initializing the Kameleoon client

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", false);
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", false, "/etc/kameleoon/client-php.json");
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", true);
    ?>
    

    After installing the SDK into your application, configuring the correct credentials (in /etc/kameleoon/client-php.json) and setting up a server-side experiment on Kameleoon's back-office, the next step is to create the Kameleoon client in your application code.

    The code on the right gives a clear example. A KameleoonClient is a singleton object that acts as a bridge between your application and the Kameleoon platform. It includes all the methods and properties you will need to run an experiment. Note that the SDK takes its settings from a configuration file. By default, the path /etc/kameleoon/client-php.json will be used, but you can use a different path for the configuration file by providing an optional third argument to the KameleoonClientFactory::create() method.

    Triggering an experiment

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", false, "/etc/kameleoon/client-php.json");
    
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $recommendedProductsNumber;
    
        try
        {
            $variationId;
            try {
                $variationID = $kameleoonClient->triggerExperiment($visitorCode, 75253);
            }
            catch (Kameleoon\Exception\NotTargeted $e)
            {
               // The user did not trigger the experiment, as the associated targeting segment conditions were not fulfilled. He should see the reference variation
                $variationID = 0;
            }
            catch (Kameleoon\Exception\NotActivated $e) {
                // The user triggered the experiment, but did not activate it. Usually, this happens because the user has been associated with excluded traffic
                variationID = 0;
            }
            catch (Kameleoon\Exception\ExperimentConfigurationNotFound $e) {
                // The user will not be counted into the experiment, but should see the reference variation
                variationID = 0;
            }
    
            if ($variationID == 0)
            {
                //We are changing number of recommended products for this variation to 5
                $recommendedProductsNumber = 5;
            }
            else if ($variationID == 148382)
            {
                //We are changing number of recommended products for this variation to 10
                $recommendedProductsNumber = 10;
            }
            else if ($variationID == 187791)
            {
                //We are changing number of recommended products for this variation to 8
                $recommendedProductsNumber = 8;
            }
    
            // Here you should have code to generate the HTML page back to the client, where recommendedProductsNumber will be used
            echo $recommendedProductsNumber;
        }
        catch (Exception $e)
        {
            echo "Exception: ",  $e->getMessage(), "\n";
        }
    ?>
    

    Running an A/B experiment on your PHP application means bucketing your visitors into several groups (one per variation). The SDK takes care of this bucketing (and the associated reporting) automatically.

    Triggering an experiment by calling the triggerExperiment() method will register a random variation for a given visitorCode. If this visitorCode is already associated with a variation (most likely a returning visitor that has already been exposed to the experiment previously), then it will return the previous variation associated with a given experiment.

    Implementing variation code

    <?php
    $recommendedProductsNumber;
    if ($variationID == 0)
    {
        //We are changing number of recommended products for this variation to 5
        $recommendedProductsNumber = 5;
    }
    else if ($variationID == 148382)
    {
        //We are changing number of recommended products for this variation to 10
        $recommendedProductsNumber = 10;
    }
    else if ($variationID == 187791)
    {
        //We are changing number of recommended products for this variation to 8
        $recommendedProductsNumber = 8;
    }
    ?>
    

    To execute different code paths depending on the variation assigned to the visitor, you will need the list of all the experiment's variation IDs. You can find these variation IDs (as well as the experiment ID) by opening the experiment in hte back-office interface.

    Once you have the IDs of the different variations, you can implement a different action for each variation, and one of the code paths will be executed, based on the associated variationID for the current visitor. Generally, this can be done using a simple if / else or switch mechanism. In our example, we just change the number of recommended products with two different variations.

    Get variationID

    Tracking conversion

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", false, "/etc/kameleoon/client-php.json");
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $recommendedProductsNumber;
    
        $goalID = 83023;
        $kameleoonClient->trackConversion($visitorCode, $goalID);
    ?>
    

    After you are done with triggering an experiment, the next step is usually to start tracking conversions. This is done to measure performance characteristics according to the goals that make sense for your business.

    For this purpose, use the trackConversion() method of the SDK as shown in the example. You need to pass the visitorCode and goalID parameters so we can correctly track conversion for this particular visitor.

    Get goalID

    Obtaining results

    Once your implementation is in place on the server side (experiment triggering, variations handling, and conversion tracking), it is time to launch the experiment on the Kameleoon platform. You do this in the same way as for a front-end test. Basic operations such as starting, pausing and stopping the experiment work exactly the same way.

    After the experiment is launched, the first results will be available on our standard results page in the back-office after a duration of 30 minutes. This is because (as is the case with front-end testing) visits are considered over after 30 minutes of inactivity. Inactivity in this context means the absence of calls sent to the Kameleoon back-end servers (such calls are made via triggerExperiment(), trackConversion() or flush() methods).

    Reference

    This is a full reference documentation of the PHP SDK.

    If this is your first time working with the PHP SDK, we strongly recommend you go over our Getting started tutorial to integrate the SDK and start experimenting in a few minutes.

    Kameleoon\KameleoonClientFactory

    create

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj");
    ?>
    

    The starting point for using the SDK is the initialization step. All interaction with the SDK is done through an object named KameleoonClient, therefore you need to create this object.

    Arguments
    NameTypeDescription
    siteCodeStringCode of the website you want to run experiments on. This unique code id can be found in our platform's back-office. This field is mandatory.
    blockingBooleanThis parameter defines if the triggerExperiment() method has a non-blocking or blocking behavior. Value true will set it to be blocking. This field is optional and set to false by default.
    configurationFilePathStringPath to the SDK configuration file. This field is optional and set to /etc/kameleoon/client-php.json by default.
    clientIDStringThis parameter is used for OAUth 2.0 authentication to our service. This field is optional, as it can be provided via the configuration file. However, it must either be supplied by the configuration file or by this method, else a Kameleoon\Exception\CredentialsNotFound exception will be thrown.
    clientSecretStringThis parameter is used for OAUth 2.0 authentication to our service. This field is optional, as it can be provided via the configuration file. However, it must either be supplied by the configuration file or by this method, else a Kameleoon\Exception\CredentialsNotFound exception will be thrown.
    Return value
    TypeDescription
    Kameleoon\KameleoonClientAn instance of the KameleoonClient class, that will be used to manage your experiments and feature flags.
    Exceptions Thrown
    TypeDescription
    Kameleoon\Exception\CredentialsNotFoundException indicating that the requested credentials were not provided (either via the configuration file, or via parameters on the method).

    Kameleoon\KameleoonClient

    obtainVisitorCode

    <?php
        require "vendor/autoload.php";
    
        $visitorCode = $kameleoonClient->obtainVisitorCode(); // The cookie's domain must be provided in the configuration file if no argument is given
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.co.uk", $userID);
    ?>
    

    This helper method should be called to obtain the Kameleoon visitorCode for the current visitor. This is especially important when using Kameleoon in a mixed front-end and back-end environment, where user identification consistency must be guaranteed. The implementation logic is described here:

    1. First we check if a kameleoonVisitorCode cookie or query parameter associated with the current HTTP request can be found. If so, we will use this as the visitor identifier.

    2. If no cookie / parameter is found in the current request, we either randomly generate a new identifier, or use the defaultVisitorCode argument as identifier if it is passed. This allows our customers to use their own identifiers as visitor codes, should they wish to. This can have the added benefit of matching Kameleoon visitors with their own users without any additional look-ups in a matching table.

    3. In any case, the server-side (via HTTP header) kameleoonVisitorCode cookie is set with the value. Then this identifier value is finally returned by the method.

    For more information, refer to this article.

    Arguments
    NameTypeDescription
    topLevelDomainStringYour current top level domain for the concerned site (this information is needed to set the corresponding cookie accordingly, on the top level domain). This field is optional, as it can be provided via the configuration file. However, it must either be supplied by the configuration file or by this method, else a InvalidArgument exception will be thrown.
    defaultVisitorCodeStringThis parameter will be used as the visitorCode if no existing kameleoonVisitorCode cookie is found on the request. This field is optional, and by default a random visitorCode will be generated.
    Return value
    TypeDescription
    StringA visitorCode that will be associated with this particular user and should be used with most of the methods of the SDK.
    Exceptions Thrown
    TypeDescription
    InvalidArgumentExceptionException indicating that the cookie's domain value was not provided (either via the configuration file, or via the topLevelDomain parameter on the method).

    triggerExperiment

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj");
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $experimentID = 75253;
        $variationID;
    
        try {
            $variationID = $kameleoonClient->triggerExperiment($visitorCode, $experimentID);
        }
        catch (Kameleoon\Exception\NotTargeted $e) {
            // The user did not trigger the experiment, as the associated targeting segment conditions were not fulfilled. He should see the reference variation
            variationID = 0;
        }
        catch (Kameleoon\Exception\NotActivated $e) {
            // The user triggered the experiment, but did not activate it. Usually, this happens because the user has been associated with excluded traffic
            variationID = 0;
        }
        catch (Kameleoon\Exception\ExperimentConfigurationNotFound $e) {
            // This experiment was not found in the SDK configuration. The user will not be counted into the experiment, but should see the reference variation
            variationID = 0;
        }
    ?>
    

    To trigger an experiment call the triggerExperiment() method of our SDK.

    This method takes visitorCode and experimentID as mandatory arguments to register a variation for a given user.

    If such a user has never been associated with any variation, the SDK returns a randomly selected variation. If a user with a given visitorCode is already registered with a variation, it will detect the previously registered variation and return the variationID.

    You have to make sure that proper error handling is set up in your code as shown in the example to the right to catch potential exceptions.

    Arguments
    NameTypeDescription
    visitorCodeStringUnique identifier of the user. This field is mandatory.
    experimentIDIntegerID of the experiment you want to expose to a user. This field is mandatory.
    timeoutIntegerTimeout (in milliseconds). This parameter is only used in the blocking version of this method, and specifies the maximum amount of time the method can block to wait for a result. This field is optional, if not provided, it will use the default value of 2000 milliseconds.
    Return value
    NameTypeDescription
    variationIDIntegerID of the variation that is registered for a given visitorCode.
    Exceptions Thrown
    TypeDescription
    Kameleoon\Exception\NotTargetedException indicating that the current visitor / user did not trigger the required targeting conditions for this experiment. The targeting conditions are defined via Kameleoon's segment builder.
    Kameleoon\Exception\NotActivatedException indicating that the current visitor / user triggered the experiment (met the targeting conditions), but did not activate it. The most common reason for that is that part of the traffic has been excluded from the experiment and should not be tracked.
    Kameleoon\Exception\ExperimentConfigurationNotFoundException indicating that the requested experiment ID has not been found in the internal configuration of the SDK. This is usually normal and means that the experiment has not yet been started on Kameleoon's side (but code triggering / implementing variations is already deployed on the web-application's side).

    activateFeature

    <?php
        require "vendor/autoload.php";
    
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $featureKey = "new_checkout";
        $hasNewCheckout = false;
    
        try {
            $hasNewCheckout = $kameleoonClient->activateFeature($visitorCode, $featureKey);
        }
        catch (Kameleoon\Exception\NotTargeted $e) {
            // The user did not trigger the feature, as the associated targeting segment conditions were not fulfilled. The feature should be considered inactive
            $hasNewCheckout = false;
        }
        catch (Kameleoon\Exception\FeatureConfigurationNotFound $e) {
            // Feature toggle not yet activated on Kameleoon's side - we consider the feature inactive
            $hasNewCheckout = false;
        }
        catch (Exception $e) {
            // This is generic Exception handler which will handle all exceptions.
            echo "Exception: ",  $e->getMessage(), "\n";
        }
        if ($hasNewCheckout)
        {
            // Implement new checkout code here
        }
    ?>
    

    To activate a feature toggle, call the activateFeature() method of our SDK.

    This method takes a visitorCode and featureKey (or featureID) as mandatory arguments to check if the specified feature will be active for a given user.

    If such a user has never been associated with this feature flag, the SDK returns a boolean value randomly (true if the user should have this feature or false if not). If a user with a given visitorCode is already registered with this feature flag, it will detect the previous featureFlag value.

    You have to make sure that proper error handling is set up in your code as shown in the example to the right to catch potential exceptions.

    Arguments
    NameTypeDescription
    visitorCodeStringUnique identifier of the user. This field is mandatory.
    featureID or featureKeyInteger or StringID or Key of the feature you want to expose to a user. This field is mandatory.
    timeoutIntegerTimeout (in milliseconds). This parameter is only used in the blocking version of this method, and specifies the maximum amount of time the method can block to wait for a result. This field is optional, if not provided, it will use the default value of 2000 milliseconds.
    Return value
    TypeDescription
    BooleanValue of the feature that is registered for a given visitorCode.
    Exceptions Thrown
    TypeDescription
    Kameleoon\Exception\NotTargetedException indicating that the current visitor / user did not trigger the required targeting conditions for this feature. The targeting conditions are defined via Kameleoon's segment builder.
    Kameleoon\Exception\FeatureConfigurationNotFoundException indicating that the requested feature ID has not been found in the internal configuration of the SDK. This is usually normal and means that the feature flag has not yet been activated on Kameleoon's side (but code implementing the feature is already deployed on the web-application's side).

    obtainVariationAssociatedData

    $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
    $experimentID = 75253;
    
    try {
        $variationID = $kameleoonClient->triggerExperiment(visitorCode, experimentID);
        $jsonObject = $kameleoonClient->obtainVariationAssociatedData(variationID);
        $firstName = $jsonObject->firstName;
    }
    catch (Kameleoon\Exception\VariationConfigurationNotFound $e) {
        // The variation is not yet activated on Kameleoon's side, ie the associated experiment is not online
    }
    catch (Exception $e) {
        // This is generic Exception handler which will handle all exceptions.
        echo "Exception: ",  $e->getMessage(), "\n";
    }
    

    To retrieve JSON data associated with a variation, call the obtainVariationAssociatedData() method of our SDK. The JSON data usually represents some metadata of the variation, and can be configured on our web application interface or via our Automation API.

    This method takes the variationID as a parameter and will return the data as a Object instance. It will throw an exception (Kameleoon\Exception\VariationConfigurationNotFound) if the variation ID is wrong or corresponds to an experiment that is not yet online.

    Arguments
    NameTypeDescription
    variationIDIntegerID of the variation you want to obtain associated data for. This field is mandatory.
    Return value
    TypeDescription
    ObjectData associated with this variationID.
    Exceptions Thrown
    TypeDescription
    Kameleoon\Exception\VariationConfigurationNotFoundException indicating that the requested variation ID has not been found in the internal configuration of the SDK. This is usually normal and means that the variation's corresponding experiment has not yet been activated on Kameleoon's side.

    obtainFeatureVariable

    $featureKey = "myFeature";
    $variableKey = "myVariable";
    $data;
    
    try {
        $data = $kameleoonClient->obtainFeatureVariable($featureKey, $variableKey);
    }
    catch (Kameleoon\Exception\FeatureConfigurationNotFound $e) {
        // The feature is not yet activated on Kameleoon's side
    }
    catch (Exception $e) {
        // This is generic Exception handler which will handle all exceptions.
        echo "Exception: ",  $e->getMessage(), "\n";
    }
    

    To retrieve a feature variable, call the obtainFeatureVariable() method of our SDK. A feature variable can be changed easily via our web application.

    This method takes two input parameters: featureKey and variableKey. It will return the data as a Object instance. Usually it should be casted to the expected type (the one defined on the web interface). It will throw an exception (Kameleoon\Exception\FeatureConfigurationNotFound) if the requested feature has not been found in the internal configuration of the SDK.

    Arguments
    NameTypeDescription
    featureID or featureKeyInteger or StringID or Key of the feature you want to obtain to a user. This field is mandatory.
    variableKeyStringKey of the variable. This field is mandatory.
    Return value
    TypeDescription
    ObjectData associated with this variable for this feature flag. This can be a Number, String, Boolean or plain Object (depending on the type defined on the web interface).
    Exceptions Thrown
    TypeDescription
    Kameleoon\Exception\FeatureConfigurationNotFoundException indicating that the requested feature ID has not been found in the internal configuration of the SDK. This is usually normal and means that the feature flag has not yet been activated on Kameleoon's side.

    trackConversion

    <?php
        require "vendor/autoload.php";
    
        $kameleoonClient = Kameleoon\KameleoonClientFactory::create("a8st4f59bj", false, "/etc/kameleoon/client-php.json");
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
        $goalID = 83023;
    
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Browser(Kameleoon\Data\Browser::$browsers["CHROME"]));
        $kameleoonClient->addData(
            $visitorCode,
            new Kameleoon\Data\PageView("https://url.com", "title", 3),
            new Kameleoon\Data\Interest(2)
        );
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Conversion(32, 10, false));
    
        $kameleoonClient->trackConversion($visitorCode, $goalID);
    ?>
    

    To track conversion, use the trackConversion() method. This method requires visitorCode and goalID to track conversion on this particular goal. In addition, this method also accepts revenue as a third optional argument to track revenue. The visitorCode usually is identical to the one that was used when triggering the experiment.

    The trackConversion() method doesn't return any value. This method is non-blocking as the server call is made asynchronously.

    Arguments
    NameTypeDescription
    visitorCodeStringUnique identifier of the user. This field is mandatory.
    goalIDIntegerID of the goal. This field is mandatory.
    revenueFloatRevenue of the conversion. This field is optional.

    addData

    <?php
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Browser(Kameleoon\Data\Browser::$browsers["CHROME"]));
        $kameleoonClient->addData(
            $visitorCode,
            new Kameleoon\Data\PageView("https://url.com", "title", 3),
            new Kameleoon\Data\Interest(0)
        );
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Conversion(32, 10, false));
    ?>
    

    To associate various data with the current user, we can use the addData() method. This method requires the visitorCode as a first parameter, and then accepts several additional parameters. Those additional parameters represent the various Data Types allowed in Kameleoon.

    Note that the addData() method doesn't return any value and doesn't interact with the Kameleoon back-end servers by itself. Instead, the declared data is saved for future sending via the flush() method described in the next paragraph. This reduces the number of server calls made, as data is usually grouped into a single server call triggered by the execution of flush().

    Arguments
    NameTypeDescription
    visitorCodeStringUnique identifier of the user. This field is mandatory.
    dataTypesDataCustom data types which may be passed separated by a comma.

    flush

    <?php
        $visitorCode = $kameleoonClient->obtainVisitorCode("example.com");
    
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Browser(Kameleoon\Data\Browser::$browsers["CHROME"]));
        $kameleoonClient->addData(
            $visitorCode,
            new Kameleoon\Data\PageView("https://url.com", "title", 3),
            new Kameleoon\Data\Interest(0)
        );
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Conversion(32, 10, false));
    
        $kameleoonClient->flush($visitorCode);
    ?>
    

    Data associated with the current user via addData() method is not sent immediately to the server. It is stored and accumulated until it is sent automatically by the triggerExperiment() or trackConversion() methods, or manually by the flush() method. This allows the developer to control exactly when the data is flushed to our servers. For instance, if you call the addData() method a dozen times, it would be a waste of ressources to send data to the server after each addData() invocation. Just call flush() once at the end.

    The flush() method doesn't return any value. This method is non-blocking as the server call is made asynchronously.

    Arguments
    NameTypeDescription
    visitorCodeStringUnique identifier of the user. This field is mandatory.

    Kameleoon\Data

    Browser

    <?php
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Browser(Kameleoon\Data\Browser::$browsers["CHROME"]));
    ?>
    
    NameTypeDescription
    browserAssociative ArrayList of browsers: CHROME, INTERNET_EXPLORER, FIREFOX, SAFARI, OPERA, OTHER. This field is mandatory.

    PageView

    <?php
        $kameleoonClient->addData(
            $visitorCode,
            new Kameleoon\Data\PageView("https://url.com", "title", 3)
        );
    ?>
    
    NameTypeDescription
    urlStringURL of the page viewed. This field is mandatory.
    titleStringTitle of the page viewed. This field is mandatory.
    referrerintReferrer of the page viewed. This field is optional.

    Conversion Data Type

    <?php
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Conversion(32, 10, false));
    ?>
    
    NameTypeDescription
    goalIDIntegerID of the goal. This field is mandatory.
    revenueFloatConversion revenue. This field is optional.
    negativeBooleanDefines if the revenue is positive or negative. This field is optional.

    CustomData

    <?php
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\CustomData(1, "some custom value"));
    ?>
    
    NameTypeDescription
    indexIntegerIndex / ID of the custom data to be stored. This field is mandatory.
    valueStringValue of the custom data to be stored. This field is mandatory.

    Interest

    <?php
        $kameleoonClient->addData($visitorCode, new Kameleoon\Data\Interest(0));
    ?>
    
    NameTypeDescription
    indexIntegerIndex / ID of the interest. This field is mandatory.