A PrestaShop module for tracking user clicks on specific page elements (WhatsApp buttons, phone links, Google Maps, CTAs). Monitor customer engagement with actionable analytics and exportable data.
This module is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement.
Important:
- Always test in a development/staging environment before production
- Create a complete backup of your store before installation
- Verify compatibility with your PrestaShop version and other modules
- The author is not responsible for any damage, data loss, or issues caused by using this module
Use at your own risk. For production environments, consider using professional installation services.
- CSS selector-based tracking: Track clicks on any element identified by CSS class or ID
- Automatic element type detection: WhatsApp, Phone, Maps, Other
- Page Selectors: Activate tracking on specific pages using body classes or IDs (e.g.,
.module-smartblog-details,#checkout) - Two tracking contexts:
- Product Pages: captures product ID, name, and category
- CMS/Blog Pages: captures page URL and title
- Overview cards: Total clicks, monthly clicks, most clicked type, top product
- Interactive charts: Clicks over time (line chart), distribution by element type (pie chart)
- Rankings: Top 10 products and top 10 CMS pages by click count
- Date range filtering: Analyze any time period
- Complete click log with filters (context, element type, date range, search)
- Pagination and sorting
- Bulk actions: Select and delete multiple entries
- CSV export with applied filters and UTF-8 support
- Vanilla JavaScript: Zero dependencies, no jQuery on frontend
- Async loading: No impact on page load speed
- Fire-and-forget tracking: User clicks are never blocked or delayed
- CSRF token protection on every AJAX request
- Rate limiting: 30 requests per minute per session
- SQL injection prevention: ObjectModel ORM with parameterized queries
- Input validation and sanitization on all data
- PrestaShop: 1.7.0.0 - 8.x
- PHP: 7.2+
- All standard PrestaShop themes
- PrestaShop 1.7.x or 8.x
- PHP 7.2 or higher
- Download the latest version from Releases
- Go to your PrestaShop back office
- Navigate to Modules > Module Manager > Upload a module
- Select the downloaded ZIP file
- Click Configure after installation
- Upload the
clicktrackerfolder to/modules/on your server - In the back office, go to Modules > Module Manager
- Search for "Click Tracker" and click Install
After installation, go to Modules > Click Tracker > Configure.
Enter the CSS selectors of elements to track, one per line:
.btn-whatsapp
.btn-phone
.btn-maps
.cta-contact
Activate tracking on specific pages by entering body classes or IDs, one per line. Use a dot for classes and a hash for IDs:
.module-smartblog-details
.cms-id-3
#checkout
This is useful when you need to track clicks on pages that are neither product nor CMS pages (e.g., blog pages from third-party modules). Leave empty to rely only on the product/CMS detection switches below.
| Setting | Description |
|---|---|
| Track Product Pages | Enable/disable tracking on product pages |
| Track CMS/Blog Pages | Enable/disable tracking on CMS pages |
| Track External Links Only | If enabled, only tracks links with http:// or https:// href |
| Debug Mode | If enabled, logs tracking events to the browser console |
View all tracked clicks with:
- Filters by context, element type, date range, and search
- Pagination
- Single or bulk delete
- CSV export
Dashboard with:
- Overview cards (total clicks, monthly clicks, most clicked type, top product)
- Clicks over time chart
- Element type distribution chart
- Context distribution (Product vs CMS)
- Top 10 most clicked products
- Top 10 most clicked CMS pages
- The module injects a lightweight JavaScript into the page header via the
displayHeaderhook - The script uses event delegation to capture clicks on configured elements
- When a tracked click is detected:
- Collects contextual data (product info or CMS page info)
- Auto-detects element type (WhatsApp, Phone, Maps, Other)
- Sends data to the server via an asynchronous AJAX call (fire-and-forget)
- The user's click is never blocked or delayed
- The AJAX controller receives the POST data
- Validates the CSRF security token
- Applies rate limiting (30 requests/minute)
- Sanitizes and validates all inputs
- Persists data to the database via ObjectModel
The script auto-detects element types based on:
- WhatsApp: href contains
wa.me,whatsapp,api.whatsapp; or class containswhatsapp,wa- - Phone: href starts with
tel:; or class containsphone,tel,call - Maps: href contains
maps.google,google.com/maps,goo.gl/maps; or class containsmaps,map - Other: Everything else
<a href="https://wa.me/391234567890" class="btn-whatsapp">
Contact us on WhatsApp
</a>Add .btn-whatsapp to the CSS Classes to Track.
<a href="tel:+391234567890" class="btn-phone">
Call us
</a>Add .btn-phone to the CSS Classes to Track.
<a href="https://goo.gl/maps/xyz123" class="btn-maps">
Get directions
</a>Add .btn-maps to the CSS Classes to Track.
If your blog module adds .module-smartblog-details to the body on detail pages, add it to Page Selectors to activate tracking on those pages.
Table: ps_clicktracker_log
| Column | Type | Description |
|---|---|---|
| id_clicktracker_log | INT | Primary key (auto-increment) |
| context_type | VARCHAR(20) | product or cms |
| id_product | INT | Product ID (nullable) |
| product_name | VARCHAR(255) | Product name (nullable) |
| id_category | INT | Category ID (nullable) |
| page_url | VARCHAR(500) | Page URL |
| page_title | VARCHAR(255) | Page title (nullable) |
| clicked_class | VARCHAR(100) | Clicked CSS class |
| element_type | VARCHAR(50) | whatsapp, phone, maps, other |
| date_add | DATETIME | Click date/time |
- Verify CSS classes are configured correctly in the module
- Verify tracking is enabled for the page type (Product/CMS) or that a matching Page Selector is set
- Enable Debug Mode and check the browser console
- Verify there are no JavaScript errors on the page
- Make sure there are no conflicts with other scripts
- Verify that elements actually have the configured classes
- Verify there is data in the database
- Check PHP temporary folder write permissions
Uninstalling this module will permanently delete:
- All click tracking data
- All module configuration settings
- The
ps_clicktracker_logdatabase table
- Go to Modules > Module Manager
- Search for "Click Tracker"
- Click the dropdown arrow and select Uninstall
- Confirm the uninstallation
- CSRF token protection on every AJAX request
- SQL injection prevention (pSQL, ObjectModel ORM)
- XSS protection (htmlspecialchars, strip_tags)
- Rate limiting (30 requests/minute per session)
- No direct file access (index.php protection)
- Input validation with whitelist approach
This module is completely free and will always be.
If you're using it in your business and it's saving you development time, please consider supporting its development:
Even a small contribution helps me:
- Keep the module updated with new PrestaShop versions
- Fix bugs faster
- Add new features based on community feedback
Thank you for your support!
Business using this module? I also offer professional services.
Need help with your PrestaShop store? I offer:
- Module Customization - Tailored modifications to fit your specific needs
- Complete PrestaShop E-commerce Development - From setup to launch
- Performance Optimization - Speed up your store
- Custom Module Development - Build exactly what you need
Contact: info@ettorestani.it | Website: https://www.ettorestani.it
This module is released under the Academic Free License (AFL 3.0).
Ettore Stani
- Email: info@ettorestani.it
- Website: https://www.ettorestani.it
- Initial release
- Click tracking on product and CMS pages
- Page Selectors for custom page activation
- Automatic element type detection (WhatsApp, Phone, Maps, Other)
- Statistics dashboard with interactive charts
- CSV export with filters
- Multi-language support (Italian, English)
If this module has been helpful:
- Star this repository
- Share it with other developers
- Contribute translations or improvements
- Support via PayPal
Made with love by Ettore Stani