This WordPress plugin tracks and stores product view data in compliance with GDPR regulations. It integrates with the Complianz plugin to ensure user consent before collecting any data. The plugin uses local storage and cookies to track product views and allows for easy retrieval of this information.
Moritz Reitz
Email: plugins@moritzreitz.com
GitHub: Moreit11
- Tracks product views and stores data securely.
- Complies with GDPR using the Complianz plugin for user consent.
- Supports integration with various post types.
- Allows customization to track additional product data.
- Download the plugin files and unzip them.
- Upload the
product-view-tracking-integrationfolder to the/wp-content/plugins/directory. - Activate the plugin through the 'Plugins' menu in WordPress.
- Ensure that the Complianz plugin is installed and configured to manage cookie consent.
To display recently viewed products or items, use the following shortcode in any post or page:
[recently_viewed_products]
To track and display your own custom post types:
- Open the
your-plugin.phpfile. - Locate the
WP_Querysection inside the function that handles displaying viewed products. - Change the
'post_type' => 'any'line to include your custom post type(s), for example:'post_type' => array('your_custom_post_type', 'another_product_type')
- Save the changes and refresh your site.
This plugin checks for user consent using the Complianz plugin. If you are using other cookie consent management plugins or services, you may need to modify the consent checking function to align with their consent checks.
If using a different plugin, update the consent checking function as follows:
function hasConsentForProductTracking() {
// Example for a different plugin
return isset($_COOKIE['another_plugin_cookie']) && $_COOKIE['another_plugin_cookie'] === 'allow';
}- The plugin ensures all user data is sanitized and validated.
- Cookies are set with the
Secure,HttpOnly, andSameSite=Strictattributes for enhanced security. - It checks for user consent before tracking any product views.
This plugin is licensed under the MIT License.