You need to sign in to do that
Don't have an account?

Identify number of times a Visualforce page has been opened
Hello All,
I would like to get a sample code to identify "How many times a Visual force page has been opened / hit " by the user.
Please guide me with the code (Visualforce remoting way / apex:variable way / best possible solution) which we can propose to customer.
Thanks !
I would like to get a sample code to identify "How many times a Visual force page has been opened / hit " by the user.
Please guide me with the code (Visualforce remoting way / apex:variable way / best possible solution) which we can propose to customer.
Thanks !
You can easily create your own tracking mechanism. Create an object, let's say VF_Tracking__c, that has a lookup(User) User__c, text(255) VF_Page_Visited__c, and dateTime Datetime_Visited__cplus anything else you want to track.
In your Visualforce controller, create a pageReference method to track who visits the page, and use it in the Action parameter in the apex:page compenent in your VF page.
Example:
Controller code:
VF:
FYI: You can do it using RemoteAction to increase the performance
Hope its help you.
<apex:page action="{!trackVisits}" controller="myVFController"> </apex:page>
Can you please share thoughts by using Visual force remoting way.
I need to update the counter in VF Page by "1" when there is an additional hit to the Visualforce Page.
So, that i can track the total number of visits to the site page.
Thanks !
Very simple and easy example https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
The example shared fetches the account through Javascript remoting and displays in the page.
I need to update the counter in VF Page by "1" when there is an additional hit to the Visualforce Page.
So, that i can track the total number of visits to the site page.
Thanks !