Home > widget-integration > FilterAPI > handleBannerParams
FilterAPI.handleBannerParams() method
Adds banner interleaving parameter if feature is enabled.
Checks template metadata for banner interleaving feature flag and includes insert_banners parameter if enabled. This tells the API to include promotional banner content in the product results. Override to customize banner insertion logic.
Signature:
protected handleBannerParams(params: FilterAPIParams): FilterAPIParams;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
params |
Current filter parameters being built |
Returns:
Enhanced parameters with insert_banners flag if feature is enabled
Remarks
Banner Interleaving: - Reads enableBannerInterleaving from templateMetadata.featureOptions - When enabled, API interleaves promotional banners with product results - Banners are configured in admin dashboard - Override to control when banners should be shown
Example
Override to add banner targeting:
window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
return class CustomFilterAPI extends FilterAPI {
protected handleBannerParams(params) {
const enhanced = super.handleBannerParams(params);
// Add banner targeting based on customer segment
if (enhanced.insert_banners) {
const customer = this.getCustomerData();
enhanced.banner_target_segment = customer?.tags?.includes('vip') ? 'vip' : 'all';
enhanced.banner_position = this.getBannerPosition();
}
return enhanced;
}
};
});