Home > widget-integration > FilterService > savingCollectionId
FilterService.savingCollectionId() method
Saves collection ID to localStorage for "all collections" tracking.
Stores the collection ID associated with the special "all" collection handle. This enables proper filtering when users navigate between specific collections and the "all collections" view.
Signature:
savingCollectionId(): void;
Returns:
void
Remarks
Only saves when on a collection page with handle='all' and the ID has changed. Used to maintain collection context across page loads.
Example
Override to add custom collection tracking:
savingCollectionId() {
super.savingCollectionId();
// Track collection views for analytics
const { collection_id, collection_handle } = this.appService.TAEAppConfig.generalSettings;
if (collection_handle === 'all') {
this.analytics.track('all_collection_viewed', { id: collection_id });
}
}