Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question

4 Answers

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.

http://en.wikipedia.org/wiki/List_of_HTTP_header_fields http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_pagereference.htm

share|improve this answer

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:

ApexPages.currentPage().getHeaders().get('Referer');
share|improve this answer
The VF page looks to be sitting in iframes on numerous pages and Ashok wants to know, when user submits, from within which page was the VF page submitted. Does this still hold for investigating the referer? I thought would show you the page that brought you to the page that has the iframe, ie the "previous" page. – JLiljegren__c Oct 4 '12 at 21:05

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

ApexPages.currentPage().getParameters().get('Referer');

Which obtains the standard Referer header: http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.