function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Peter SchultzPeter Schultz 

Track Visualforce page visits by users in new community

We have a new community that we would like to breadcrumb as much as possible.   What I would like to do is track each user on each VF page load.

Right now i use the following apex but I am having trouble figuring a way to incorporate this into other pages with their own apex controllers. my understanding is that i could not put this into a component but  I am interested in any options that doesnt require an extension per page

I borrowed almost 100% of the code from

public class TrackVF{

    public pageReference trackVisits(){
        VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),Page_Visited__c=URL.getCurrentRequestUrl().toExternalForm(),;
        insert newTracking;
        return null;
    }//END trackVisits

}//END class
Bryn JonesBryn Jones
Option 1: Awesome free SF Labs app.    

OR  If you like to spend money this is the app for you...

I would recommend the first as the second seems quite labourous to set up....
Hope this works out for you....if it did please mark as answer...
Peter SchultzPeter Schultz
the first one doesn seem to let me know which user visited that page, the second might work but I was hoping for something that I could extend to track other things (cookie etc) as needed