Get Visualforce usage stats from VisualforceAccessMetrics

If you want to know how frequently your Visualforce pages are accessed, you just have to run a simple query on VisualforceAccessMetrics:

SELECT ApexPageId,DailyPageViewCount,Id,MetricsDate FROM VisualforceAccessMetrics

That query will return stats from the latest 90 days

Page views are tallied the day after the page is viewed, and each VisualforceAccessMetrics object is removed after 90 days.

But BEWARE, that query could return deleted pages. To fix that, let’s tweak the query to:

SELECT Id, Markup, Name, NamespacePrefix FROM ApexPage WHERE Id IN (SELECT ApexPageId FROM VisualforceAccessMetrics)

Now the query will return only existing pages.

Photo by Kevin Ku on Unsplash

Astro image comes from SLDS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s