Tracking Users Based Upon Iframe

Status
Not open for further replies.

Aequitas

New member
Feb 19, 2007
2,954
73
0
Canada
I've never done this before and after doing a little research and thinking about it, I really don't think it would be possible just because of the amount of security issues it could pose but I figured I'd see if anyone else around here has tried or can suggest something else for me to look into.

Basically I've got a simple webpage created, next I have an iframe in that webpage that people can use to surf the net, I need some way to track the users surfing the net from the iFrame on my site. More specifically I need to know if a users makes a post on a site by using the iframe on my site.

Basically I was thinking of tossing something into there cookies to do this and when they return to my site I can get pharse through the data but this is too unsecure for my purpose, the easiest way would be to track the users through the iframe.

As I said I don't think it can be done because of the security issues it poses but any suggestions on what I can do here?
 


You can't look at things with Javascript like the iframe source, the iframes current URL, etc....that's all too insecure.

The best thing you would be able to do is track the URL(s) they enter into YOUR url bar (I imagine you have a URL form with the iframe as the target)...just add an onsubmit action to that that logs the URL. You could do this by onsubmit, loading log_url.php?url=url into a(n) (i)frame.

Something like this.

Code:
<form blahblahblah onsubmit="frames['iframe'].location='log_url.php?url=' + document.getElementById('form_url').value;">
    <input type="text" name="url" id="form_url" value="http://www.google.com" />
    <input type="submit" name="submit" value="go!" />
</form>
<iframe src="" width="1" height="1" frameborder="0" name="iframe"></iframe>

Also see: Javascript - Iframes

HOWEVER.....

It would be much easier just to submit the form to the iframe they're browsing in, which would be a page on your site called redirect.php, and then log the URL before you do a header('Location: ')...that's much simpler. :P
 
Status
Not open for further replies.