View Full Version : How to track User's actions (i.e. mouse clicks) inside frames (or another means)

05-27-2009, 02:13 AM
I am building a website that offers cash to users for completing offers. Such as signing up on a site and you get $1.

I have very little javascript knowledge. But I do know that it can be used to "listen" for mouse clicks and such. So I am wondering how to go about it.

Can I somehow, listen for mouseclicks a user makes, tracking what they clicked on, when they clicked on it, etc. inside a iframe, then pass the values thru php into my DB?

I have also just started learning about cookies too, The other 'offer' sites I am a member of, and I would like to duplicate, (ex. www.inboxdollars.com) say sit uses cookies to track user actions for verifications. Any thoughts?

Old Pedant
05-27-2009, 02:33 AM
You can't do *ANYTHING* in JavaScript in a window or frame where the URL of that frame is not from the same domain as the domain where the JS is loaded from.


I assume that these "offers"--and therefor the <iframe>s--are coming from vendors. What you would probably need to do is use a "proxy" on your web server. That is, you'd use server-side code to go out to these various sites and retrieve their HTML. Then you'd present that HTML to the user but coming from *your* domain. And of course now it's easy: You don't even have to do cross-frame scripting. You could just dump in your own JS code into their pages to catch the user clicks. Or in fact have clicks in those frames come back to your server side code, where you record the click and then do a Response.Redirect to send the user off to the actual offer page.

HOWEVER... This all assumes that the vendors don't mind you grabbing their content via your server-side code.