What this section controls
This section controls product history displays with the following capabilities:- Browser-based automatic product view tracking
- Display of 4-12 recently viewed products (configurable)
- Two layout styles for visual presentation
- Auto-hide when no product history exists
- Local storage persistence across visits
- Section heading with customizable size
- Product columns control for desktop and mobile
- Color scheme, width, and spacing controls
- Display on any page template
Key Features
Browser Storage
Automatically tracks product views in browser local storage
Personalized History
Shows up to 12 recently viewed products per customer
Auto-Hide Empty
Section automatically hides when no products have been viewed
Two Layouts
Choose between two visual layout styles
How It Works
Automatic Tracking
Automatic Tracking
Product View Detection:
- JavaScript automatically tracks when customers view product pages
- Stores product IDs in browser’s local storage
- Updates history in real-time as browsing continues
- Persists across multiple visits (until browser data is cleared)
- Only tracks products when customer visits product pages
- Excludes currently viewed product from display
- Stores up to configured maximum (4-12 products)
- Newest views push out oldest when limit is reached
The tracking happens automatically via JavaScript - no manual configuration needed. Customers must have JavaScript enabled and browser local storage available.
Display Logic
Display Logic
When Section Appears:
- Customer has viewed at least one product
- Browser local storage contains product history
- Section is added to a page template (product page, homepage, etc.)
- No products have been viewed yet (first visit)
- Browser local storage is empty or cleared
- All recently viewed products are unavailable (if show unavailable is disabled)
- If viewing a product page, that product is excluded from the recently viewed list
- This prevents showing the same product the customer is currently viewing
Product Limit & Ordering
Product Limit & Ordering
Maximum Products: 4-12 products (configurable)
- Default: 8 products
- Shows most recently viewed first
- Older products removed as new ones are viewed
- Newest viewed products appear first
- Chronological order from most to least recent
- Automatically updates as customer continues browsing
- Products arranged in responsive grid
- Number of columns adapts to screen size
- Uses theme’s standard product card component
Section Settings
Layout Style
Layout Style
Layout
- Layout 1: Standard layout style
- Layout 2: Alternative layout style
- Default: Layout 1
Layout options control the visual arrangement and styling. Test both to see which fits your store’s design better.
Section Header
Section Header
Heading
- Section title text
- Supports inline rich text (bold, italic, links)
- Default: “Recently Viewed Products”
- H6 (XS), H5 (S), H4 (M), H3 (L), H2 (XL)
- Default: H2 (XL)
Section Button
Section Button
Product Display
Product Display
Maximum Products
- Range: 4-12 products
- Default: 8 products
- Controls how many products appear in the section
- More products = more scrolling required
- When enabled: Shows all recently viewed products (even if sold out)
- When disabled: Hides products that are unavailable
- Default: Disabled
Section Width & Color
Section Width & Color
Section Width
- Page: Standard page width with margins
- Fluid: Minimal side margins, edge-to-edge
- Default: Page
- Choose from available color schemes
- Default: Scheme 1
Spacing & Borders
Spacing & Borders
Spacing Top
- Padding above section: None, S (1), M (2), L (4), XL (6)
- Default: M (2)
- Padding below section: None, S (1), M (2), L (4), XL (6)
- Default: M (2)
- None, Top, Bottom, or Both
- Default: None
- Adds thin border line to separate section
Setup & Placement
Add Section
In Theme Customizer, add the “Recently Viewed Products” section to your desired template (product page, homepage, etc.).
Test Tracking
View several product pages in your preview to populate the recently viewed list and see how it displays.
Best Placement Locations
Product Pages
Perfect for cross-sellingShows other products customer has viewed, encouraging comparison shopping
Homepage
Great for returning visitorsHelps customers quickly find products they were interested in on previous visits
Cart Page
Suggests additional itemsReminds customers of other products they viewed while deciding what to buy
Collection Pages
Enhances navigationProvides quick access to previously viewed items while browsing categories
Technical Details
Browser Storage
Browser Storage
Local Storage Implementation:
- Uses browser’s
localStorageAPI - Stores product IDs as JSON array
- Key typically:
recentlyViewedProductsor similar - Data persists until browser cache is cleared
- Most browsers allow ~5-10MB of local storage
- Product IDs are small (a few bytes each)
- Practically unlimited for product tracking purposes
- Data stored locally on customer’s device only
- Not sent to servers or shared
- Customers can clear via browser settings
- Respects private/incognito browsing limits
Local storage is domain-specific. If customer switches between
www.yourstore.com and yourstore.com, they may see different recently viewed products.JavaScript Requirements
JavaScript Requirements
Dependencies:
- JavaScript must be enabled in browser
- Local storage must be available (not disabled)
- Modern browser (supports localStorage API)
- If JavaScript disabled: Section doesn’t appear
- If localStorage full: Oldest products removed first
- If localStorage blocked: Section hides gracefully
- Lightweight tracking code (~2-5KB)
- No server requests for tracking
- Fast rendering (products loaded from cache)
Product Card Integration
Product Card Integration
Uses Standard Product Cards:
- Same card component as product grids
- Inherits theme’s product card settings
- Respects card layout configuration
- Includes images, titles, prices, variants
- Marked as “Sold Out” if setting is enabled
- Filtered out if setting is disabled
- Quick add/cart actions may be disabled
Best practices
Optimal product limits
Display 6-8 products on product pages to encourage exploration without overwhelming visitors. Show 8-12 products on homepage where more space is available and returning visitors appreciate more options. Limit cart page to 4-6 products as a subtle reminder without distracting from checkout.
Heading copy suggestions
For B2C stores use “You Recently Viewed”, “Come Back To These”, or “Still Interested?”. Fashion stores work best with “Your Style History” or “Products You Loved”. Tech stores benefit from “Your Recent Searches” or “Items You Compared”. Use “Recently Viewed Products” as a clear, straightforward default for general stores.
Button strategy
Link to main catalog with “View All Products”, link to new arrivals with “See What’s New”, or link to sale collection with “Browse Sale Items”. Leave button empty for product pages to avoid navigation distraction and keep focus on the current product.
Storage considerations
Customer viewing history persists indefinitely until browser cache or cookies are cleared. Each browser and device maintains separate storage. No automatic expiration exists, so history remains across all visits until manually cleared or storage limits are reached.
Testing requirements
Use incognito or private browsing to test fresh visitor experience. Clear local storage to reset recently viewed products and view products in different orders to test chronological sorting. Check displays on both desktop and mobile devices and test with sold-out products to verify unavailable product handling.
Common troubleshooting
If section never appears, verify customers have JavaScript enabled and viewed at least one product. Products disappearing means customer cleared browser cache or cookies. Unavailable products showing requires enabling the “Show Unavailable Products” setting. Differences between mobile and desktop indicate separate browsers or cleared cache on one device.
Common Questions
How long does viewing history persist?
How long does viewing history persist?
Indefinitely, until:
- Customer clears browser cache/cookies
- Customer uses browser’s “Clear browsing data” function
- Browser storage limit is reached and older data is removed
- Customer uses a different browser or device (each has separate storage)
Can I show more than 12 products?
Can I show more than 12 products?
Not via theme settings. The maximum is limited to 12 to prevent:
- Overwhelming customers with too many options
- Performance issues with large product grids
- Excessive scrolling on mobile devices
max_products range, though this is not recommended for UX reasons.Does this work for guest visitors?
Does this work for guest visitors?
Yes! Recently viewed products work for all visitors:
- Guest (not logged in)
- Logged-in customers
- First-time visitors (after viewing first product)
Why don't I see recently viewed products on my own store?
Why don't I see recently viewed products on my own store?
Common reasons:
- You haven’t viewed any products yet in that browser session
- You cleared your browser cache recently
- You’re using incognito/private browsing mode (limited storage)
- JavaScript is disabled or blocked
- The section isn’t added to the current page template
Can I customize which products are tracked?
Can I customize which products are tracked?
No, the tracking is automatic and includes all product page views. There’s no way to:
- Exclude specific products from tracking
- Manually add products to viewing history
- Filter by collection or product type
- Prioritize certain products over others
Does this slow down my store?
Does this slow down my store?
No. Recently Viewed Products is very lightweight:
- Tracking happens client-side (in browser)
- No server requests for tracking
- Minimal JavaScript (~2-5KB)
- Products loaded from browser cache
- No API calls required
Privacy & Data
GDPR & Privacy Compliance
GDPR & Privacy Compliance
Data Storage:
- Stored locally on customer’s device only
- Not transmitted to servers
- Not shared with third parties
- Not used for tracking across sites
- Customers can clear data via browser settings
- Private/incognito browsing limits storage
- No customer account required
- Generally considered functional storage (required for feature)
- May not require explicit cookie consent in most jurisdictions
- Consult legal advisor for specific compliance requirements
Cross-Device Synchronization
Cross-Device Synchronization
Recently viewed products do not sync across devices or browsers:
- Each browser has independent storage
- Switching from mobile to desktop shows different histories
- Logging in doesn’t sync viewing history
- Clearing cache on one device doesn’t affect others
Related Sections & Features
- Product Recommendations: Shopify’s AI-powered recommendations (alternative approach)
- Featured Products: Manually curated product selections
- Product Grids: Standard product collection displays
- Card Product Component: The component used to display products in this section
Developer Notes
JavaScript API
JavaScript API
The section typically uses a JavaScript function like:Check theme’s JavaScript files for exact implementation details.
Local Storage Key
Local Storage Key
Products are typically stored under a key like:Returns JSON array of product IDs:
["123456", "234567", "345678"]