recently-viewed-products

Track and display recently viewed product IDs in browser storage for e-commerce frontends.

14|3|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/tomtoto757/ecomm-ai-skills-hub --skill recently-viewed-products-tomtoto757
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: recently-viewed-products
Source: https://github.com/tomtoto757/ecomm-ai-skills-hub/tree/main/skills/storefront-shopping-experience/finsilabs/storefront-ui/recently-viewed-products
Command: npx skills add https://github.com/tomtoto757/ecomm-ai-skills-hub --skill recently-viewed-products-tomtoto757

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide a lightweight, privacy-conscious way to track which products a customer has browsed and surface them in a "Recently Viewed" widget so returning visitors can continue shopping without a backend dependency.

Core Features & Use Cases

  • Store only product IDs with timestamps in browser storage (localStorage or sessionStorage) to avoid stale prices and to respect GDPR flows.
  • Deduplicate and cap history (most-recent-first, max 12) with TTL expiration (30 days) and graceful silent-failure fallbacks for private browsing.
  • Re-fetch product data from a server-side batch endpoint before rendering to ensure only published, in-stock items are shown; ideal for product pages, cart drawers, and headless storefronts.

Quick Start

Add the Recently Viewed widget to your product page so it records viewed product IDs client-side and fetches fresh product data from a batch endpoint before rendering.

Frequently Asked Questions about recently-viewed-products

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a recently viewed products widget to a headless storefront?

Add a recently viewed widget to your headless storefront by storing product IDs client-side in localStorage, then re-fetching fresh product data via a server-side batch endpoint to ensure SSR-safe hydration and display only published items.

Does the recently viewed product widget respect GDPR and privacy modes?

The recently viewed product widget respects privacy by storing only product IDs locally in browser storage. It includes silent-failure fallbacks for private browsing and avoids backend tracking, aligning with GDPR flows.

What is the best way to prevent stale prices in a recently viewed products list?

To prevent stale prices in a recently viewed products list, store only product IDs with timestamps instead of full product data. Re-fetch current product details from a server-side batch endpoint before rendering the widget.

How do I handle deduplication and history limits for recently viewed items?

Handle deduplication for recently viewed items by ordering them most-recent-first, enforcing a maximum history cap of 12 items, and applying a 30-day TTL expiration to automatically remove outdated browsing history.

Can I use sessionStorage instead of localStorage for recently viewed product tracking?

You can use either sessionStorage or localStorage for recently viewed product tracking. Both options provide lightweight client-side storage for product IDs, allowing seamless integration into product pages, cart drawers, and homepages.

Why does my recently viewed widget show out-of-stock items?

Your recently viewed widget may show out-of-stock items if it skips server-side validation. The widget must filter published and in-stock products by re-fetching fresh product data from a server-side batch endpoint before rendering.