Find your content:

Search form

You are here

How to know where the requests come from to my VF page?


I have a public contactus page(VF page that is hosted using SF sites). I am displaying that contactus page on multiple websites using iFrame. Now the question is that i want to know where the requests come from to my contactus page?

Attribution to: Ashok

Possible Suggestion/Solution #1

This functionality only can be achieved through google analytics.Google analytics has to be integrated .Its a Javascript that google provides and salesforce sites supports

Few blogs above you may want to look at

Attribution to: Mohith Shrivastava

Possible Suggestion/Solution #2

I would interrogate the headers and request parameters, try to find the host or User-Agent request header, which might indicate the source of the HTTP Request.

Attribution to: techtrekker

Possible Suggestion/Solution #3

If you want really good detailed statistics go with something like Google Analytics as Mohith suggested. But that's not really a native SFDC solution, and if you're looking for something that actually affects the way your apex runs based on where the request came from you're going to need something more integrated.

In that case I'd reccomend looking at the request's Referer header. This header's value will tell you what page, if any, sent the user to this one. It's not 100% tamper proof as there are browser extensions that can allow faking this, but it's probably the best you're going to get.

You can get the value of this in apex with:


Attribution to: ca_peterson

Possible Suggestion/Solution #4

To do it programatically from the controller, you can call this method:


Which obtains the standard Referer header:

This is used by Google analytics too and all technology which tracks origins of clicks

Attribution to: Steven Herod
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content