views:

109

answers:

1

Hi, I have an embedable widget. For each impression, I would like to track the referrer (the page where the widget is embedded onto). Right now I am using ExternalInterface to use javascript to check window.location.href when its available, however, I am finding that most of the time I am unable to set the referrer.

Is there a better way to do this? Or perhaps am I not using javascript correctly to get the referrer?

Thanks!

A: 

I don't think you can directly get it in this way. There are a couple options I can think of:

  1. Get the referrer from your web server HTTP logs. Apache for example logs referrer info by default.
  2. Have people include some referral code in their widget request, that you can use to identify where it came from.
  3. Make a request from your widget back to your server...I think this request will contain the HTTP Referrer field pointing at where it is embedded
  4. Use something like [swfmill][1] to embed the referrer into the actual SWF itself when it is requested from your server...but this might have too much performance overhead.
davr