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
https://login.salesforce.com/help/doc/en/sites_analytics_tracking_code.htm
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
http://adnsandbox.com/df08/sites_integrating_google_analytics.pdf
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.
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_pagereference.htm
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:
ApexPages.currentPage().getHeaders().get('Referer');
Attribution to: ca_peterson
Possible Suggestion/Solution #4
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
Attribution to: Steven Herod
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1951