Content Optimizer

Prev Next

Suggested readings: App Content Optimizer, Use Cases for App Content Optimizer

The following methods are required to create variables for App Content Optimizer depending on the data type.

Retrieving Content with Stored Data

The Content Optimizer feature provides methods that store the last retrieved data on the device. When using these methods, the SDK retrieves and returns the most recently fetched value, reducing the need for repeated network requests. This approach enhances performance and ensures consistent content availability across sessions.

If prefer to prioritize efficiency and reliability can use these methods to maintain seamless content delivery without requiring a fresh data request each time.

Get string data

This method allows you to retrieve a string type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueString
dataTypeContentOptimizerDataType

Method Signature

static getContentStringWithName(variableName: string, defaultValue: string, contentOptimizerDataType: number, callback: Function)

Method Example

RNInsider.getContentStringWithName("variableName", "defaultValue", ContentOptimizerDataType.Content, (contentString) => {
    console.log("getContentStringWithName:", contentString);
});

Get boolean data

This method allows you to retrieve boolean type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueBoolean
dataTypeContentOptimizerDataType

Method Signature

static getContentBoolWithName(variableName: string, defaultValue: boolean, contentOptimizerDataType: number, callback: Function)

Method Example

RNInsider.getContentBoolWithName("variableName", true, ContentOptimizerDataType.Content, (contentBoolean) => {
    console.log("getContentBoolWithName:", contentBoolean);
});

Get integer data

This method allows you to retrieve integer type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueInteger
dataTypeContentOptimizerDataType

Method Signature

static getContentIntWithName(variableName: string, defaultValue: number, contentOptimizerDataType: number, callback: Function)

Method Example

RNInsider.getContentIntWithName("variableName", 10, ContentOptimizerDataType.Content, (contentInt) => {
    console.log("getContentIntWithName:", contentInt);
});

Retrieving Content Without Stored Data

For use cases that require real-time content updates can use alternative methods that always request the latest data from the backend instead of using stored values. These methods ensure that the most up-to-date information is retrieved at the time of request, making them ideal for time-sensitive campaigns or dynamic content updates.

By using this approach, gain full control over content freshness, ensuring that the latest data is always reflected in their applications. If real-time data is not available at the time of the request, the specified default value will be returned, maintaining a smooth user experience.

Get string data

This method allows you to retrieve string type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueString
dataTypeContentOptimizerDataType

Method Signature

static getContentStringWithoutCache(variableName: string, defaultValue: string, contentOptimizerDataType: InsiderContentOptimizerDataType, callback: (content: string) => void): void;

Method Example

Insider.getContentStringWithoutCache('variable_name', 'defaultValue', InsiderContentOptimizerDataType.Element, value => console.log('[INSIDER [getContentStringWithoutCache]: ', value));

Get boolean data

This method allows you to retrieve boolean type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueBoolean
dataTypeContentOptimizerDataType

Method Signature

static getContentBoolWithoutCache(variableName: string, defaultValue: boolean, contentOptimizerDataType: InsiderContentOptimizerDataType, callback: (content: boolean) => void): void;

Method Example

Insider.getContentBoolWithoutCache('variable_name', true, InsiderContentOptimizerDataType.Element, value => console.log('[INSIDER [getContentStringWithoutCache]: ', value));

Get integer data

This method allows you to retrieve integer type of data.

your title goes here
To add Content Optimizer variables, you need to add your device as a test device first. After adding it as a test device, you need to trigger the Content Optimizer method to display the respective variable in the Content Optimizer variables.
ParameterType
variableNameString
defaultValueInteger
dataTypeContentOptimizerDataType

Method Signature

static getContentIntWithoutCache(variableName: string, defaultValue: number, contentOptimizerDataType: InsiderContentOptimizerDataType, callback: (content: number) => void): void;

Method Example

Insider.getContentIntWithoutCache('variable_name', 10, InsiderContentOptimizerDataType.Element, value => console.log('[INSIDER [getContentStringWithoutCache]: ', value));