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

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
http://salesforce.stackexchange.com/questions/14754/tracking-visualforce-page-usage
public class TrackVF{
public pageReference trackVisits(){
VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),Page_Visited__c=URL.getCurrentRequestUrl().toExternalForm(),Datetime_Visited__c=datetime.now());
insert newTracking;
return null;
}//END trackVisits
}//END class
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
http://salesforce.stackexchange.com/questions/14754/tracking-visualforce-page-usage
public class TrackVF{
public pageReference trackVisits(){
VF_Tracking__c newTracking = new VF_Tracking__c(User__c=UserInfo.getUserId(),Page_Visited__c=URL.getCurrentRequestUrl().toExternalForm(),Datetime_Visited__c=datetime.now());
insert newTracking;
return null;
}//END trackVisits
}//END class
OR If you like to spend money this is the app for you...https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009vCIwEAM.
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...
Bryn