5

How can I calculate number of times a record has been viewed?

4
  • 1
    if that is viewed by VF page only - add some action to VF page that is executed when page is loaded and increase some counter.
    – kurunve
    Mar 25, 2016 at 6:22
  • 1
    Actually, what do you put in 'view'? Is it when your record appear in search results or just open in separate detail page? Or maybe, retrieved via SOAP/REST API? Mar 25, 2016 at 7:07
  • 1
    Sid.. you may want to look into this post Page Views Counter widget in salesforce and Working with Cookies on Sites pages
    – Ratan Paul
    Mar 25, 2016 at 9:05
  • also in reports, and list views. what is considered "view" Sep 13, 2022 at 10:51

1 Answer 1

1

If you display the record in a Visualforce page, you can include Google Analytics code in the page. This will generate stats on sessions, page-views and users. Here's some sample code.

1
  • yes but google analytics is a bit excessive. why not just a an initized counter in that visualforce page writing back to the record. Google analytics opens up a much larger security conversation, and assumes the user has/wants GA. What we do know is they have salesforce. Sep 13, 2022 at 10:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .