How can I calculate number of times a record has been viewed?
-
1if that is viewed by VF page only - add some action to VF page that is executed when page is loaded and increase some counter.– kurunveMar 25, 2016 at 6:22
-
1Actually, 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?– Andrii MuzychukMar 25, 2016 at 7:07
-
1Sid.. you may want to look into this post Page Views Counter widget in salesforce and Working with Cookies on Sites pages– Ratan PaulMar 25, 2016 at 9:05
-
also in reports, and list views. what is considered "view"– TheArchitectaSep 13, 2022 at 10:51
1 Answer
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.
-
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