Is there any hook that can be used for logging contact views? We need to create report for that and first of course need to put that information to database.
With contact view, I guess you mean when a contact summary page for a specific id is loaded you want me to increment a count number and store it in DB to display it in the report.
Currently, there is no such feature in core civicrm. You need to add a custom extension to add this functionality. See more details to build a simple ext at https://docs.civicrm.org/dev/en/latest/extensions/civix/. Some basic steps would be -
- Add a custom field to extend Contact eg
hook_civicrm_summaryto increment the value of this field for a specific contact ID.
You can use this custom field to show on any report provided by civicrm.