Magento – How to Get Recently Viewed Products in Magento 2 Using Customer Entity Id

catalogmagento2PHPproducts

I want to display the recently viewed products name and products id of a particular customer using customer entity id.

How can I do that in Magento 2 programmatically?

Best Answer

You can use default table report_event to get information about visited pages.

All product IDs saved at the column object_id, customer id saved at subject_id.

You need to get all records with event_type_id == 1(catalog_product_view)