Home > widget-integration > FilterAPI > addCollectionScope
FilterAPI.addCollectionScope() method
Adds collection scope and tag parameters from app configuration.
Includes collection_id and associated tags from general settings when filtering within a specific collection context. Override to customize collection scoping or add additional collection-based parameters.
Signature:
protected addCollectionScope(params: FilterAPIParams): FilterAPIParams;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
params |
Current filter parameters being built |
Returns:
Enhanced parameters with collection_scope and tag if collection context exists
Remarks
Collection Scoping: - Only adds parameters if collection_id exists in general settings - Includes first tag from collection_tags array - Used to scope search/filter results to specific collection - Empty string tag if no collection tags configured
Example
Override to add collection metadata:
window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
return class CustomFilterAPI extends FilterAPI {
protected addCollectionScope(params) {
const enhanced = super.addCollectionScope(params);
// Add collection handle for better tracking
const collectionId = this.appService.TAEAppConfig.generalSettings?.collection_id;
if (collectionId) {
enhanced.collection_handle = this.getCollectionHandle(collectionId);
enhanced.collection_type = this.getCollectionType(collectionId);
}
return enhanced;
}
};
});