Answers.Body: <p>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.</p>
  <p>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 <a href="https://docs.civicrm.org/dev/en/latest/extensions/civix/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/extensions/civix/</a>. Some basic steps would be -</p>
  <ul>
  <li><p>Add a custom field to extend Contact eg <code>View Count</code>.</p>
  </li>
  <li><p>Use <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/" rel="nofollow noreferrer"><code>hook_civicrm_summary</code></a> to increment the value of this field for a specific contact ID.</p>
  </li>
  <li><p>You can use this custom field to show on any report provided by civicrm.</p>
  </li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-21T16:14:20.033Z
Answers.Text: Yes. Thank you, so the summary is the right hook for that. That doesn't work in search results but I think its enough for now.
Answers.UserDisplayName: Teemu Parkkinen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-21T16:15:11.783Z
Answers.Text: And no, we don't need the count. We need information about who has seen that contact and when.
Answers.UserDisplayName: Teemu Parkkinen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-21T15:59:46.337Z
Answers.LastActivityDate: 2019-02-21T15:59:46.337Z
Answers.LastEditDate: 2020-06-17T09:00:50.810Z
Answers.UserDisplayName: jitendra - fuzion
Body: <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-21T13:12:15.550Z
Comments.Text: I am unclear on what you are asking (but that might be me)?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-21T14:29:52.727Z
Comments.Text: I just want to write log every time when user views some contact. There is logging for edit or delete but not for view.
Comments.UserDisplayName: Teemu Parkkinen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-21T22:43:27.700Z
Comments.Text: Jitendra has provided an approach for you to log contact summary views, but be aware that you can get contact information in many ways besides the viewing a contact summary.  What is the purpose of the report?  It will show you who viewed a contact summary page, not who viewed information about a contact.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-26T17:02:24.957Z
Comments.Text: Aidan yes that's a little problem because we need to know who have seen contact informations in every way.
Comments.UserDisplayName: Teemu Parkkinen
Tags: <contacts>
Title: Hook for contact view
ThreadText: # Hook for contact view
  
  (Asked by: username_0 on 2019-02-21)
  
  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.
  
  **Tags:** contacts
  
  > **Comments:**
  > **username_1**: I am unclear on what you are asking (but that might be me)?  
  > **username_0**: I just want to write log every time when user views some contact. There is logging for edit or delete but not for view.  
  > **username_2**: username_3 has provided an approach for you to log contact summary views, but be aware that you can get contact information in many ways besides the viewing a contact summary.  What is the purpose of the report?  It will show you who viewed a contact summary page, not who viewed information about a contact.  
  > **username_0**: username_2 yes that's a little problem because we need to know who have seen contact informations in every way.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-02-21. Score: 2
  
  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 `View Count`.
  * Use [`hook_civicrm_summary`](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_summary/) to 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.
  
  > **Comments:**
  > **username_0**: Yes. Thank you, so the summary is the right hook for that. That doesn't work in search results but I think its enough for now.  
  > **username_0**: And no, we don't need the count. We need information about who has seen that contact and when.  
  
  ---
  
  