search_tracker
Search Tracker is a privacy-focused module that automatically captures and displays users' recent search terms using browser localStorage. Unlike traditional search modules that store data server-side, this module keeps all search history locally in each user's browser, ensuring complete privacy and reducing server load.
Perfect for sites with search functionality that want to improve user experience without compromising privacy or requiring database storage for search terms.
Features
- Automatic Term Capture: Automatically detects and stores search terms from configurable URL parameters
- Privacy-First Approach: All data stored client-side in localStorage - no server-side storage
- Configurable Parameters: Set which URL parameter to monitor (default: 'search')
- Path-Based Activation: Choose specific pages where search tracking should activate (supports wildcards)
- Flexible Display Block: Shows recent searches as clickable links for easy re-searching
- User Control: Built-in "Clear History" functionality for users
- Duplicate Prevention: Intelligently handles duplicate consecutive searches
- Lightweight: Minimal impact on site performance
- Mobile-Friendly: Works seamlessly across all devices
Use Cases:
- E-commerce sites wanting to show customers their recent product searches
- Content sites helping users quickly revisit previous search queries
- Any site with search functionality that wants to improve user experience
- Organizations requiring strict privacy compliance (no server-side search logging)
Post-Installation
- Enable the module:
drush en search_tracker - Configure permissions: Go to
/admin/people/permissionsand assign "Administer Search Tracker settings" to appropriate roles - Configure settings: Navigate to
/admin/config/search/search-trackerto:- Set the URL parameter name your search uses (e.g., 'search', 'q', 'keywords')
- Configure maximum number of terms to store (default: 10)
- Define which paths should activate tracking (e.g., '/search', '/search/*')
- Customize the localStorage key if needed
- Place the block: Go to
/admin/structure/blockand place the "Search Tracker" block in your desired region - Test: Perform searches on your configured paths and verify the history appears in your block
No additional configuration required! The module works automatically once configured. Users will see their search history populate as they search your site.
Additional Requirements
- Drupal Core: Requires Drupal 9, 10, or 11
- Browser Support: Modern browsers with localStorage support (Chrome 4+, Firefox 3.5+, Safari 4+, IE 8+)
- JavaScript: Requires JavaScript to be enabled in users' browsers
- No external dependencies: Works entirely with Drupal core - no additional modules or libraries required
Recommended modules/libraries
While Search Tracker works independently, it pairs well with:
- Search API: For advanced search functionality (configure parameter as 'search_api_fulltext')
- Apache Solr Search: For enterprise search capabilities
- Views: To create custom search result pages
- Autocomplete Deluxe: For enhanced search input fields
Similar projects
How Search Tracker differs from alternatives:
- vs. Search Log modules: We store data client-side for privacy, not server-side
- vs. Database-driven history: No database bloat or privacy concerns
- vs. Cookie-based solutions: localStorage provides more storage space and better performance
- vs. Session-based tracking: History persists across browser sessions
Search Tracker is unique in its privacy-first approach and zero server-side footprint.
Supporting this Module
This module is developed and maintained as a contribution to the Drupal community. You can support its development by:
- ⭐ Starring the project if you find it useful
- 🐛 Reporting bugs and suggesting improvements in the issue queue
- 🔧 Contributing code improvements and patches
- 📖 Improving documentation and translations
- 💬 Helping other users in the support forums
Community Documentation
- GitHub Repository: [Link when available] - Full source code and development
- Demo Site: [Consider setting up a DrupalPod demo]
- Issue Queue: Report bugs, request features, or get support
- Module Documentation: Comprehensive README included with installation
Technical Implementation
For developers interested in the technical details:
- Storage Method: HTML5 localStorage API
- Data Format: JSON array of search terms
- Performance: Lazy loading - JavaScript only loads on configured paths
- Privacy: Zero server-side data collection or storage
- Extensibility: Clean, documented code ready for customization
Perfect for sites that value user privacy, performance, and user experience enhancement!