I created a widget that users of my site will embed on their web sites. I want to track the amount of times a widget renders as well as the referring URL. The widget was written in flex and my back end is Rails.
One obvious way to do this would be to have my widget make a service call to the back end to register a hit. However, when my widget loads, it grabs a config XML. If I add another render service call, that will be 3 requests per widget render (one to get the swf, one to get the config, one to render). I could make the config.xml dynamic and just process a render there, and then return the XML...but could this be bad for scaling?
Another would be to make the embed source URL point to a script that processes a hit and then returns a swf...i am pretty sure this is possible. But I am also not sure if this is the best way.
I am interested in any professional advice on this. How do the pros efficiently implement this simple system?
Thanks!