Page 1 of 1
external iframe, track exit link
Posted: Wed Jun 28, 2006 1:12 pm
by LinuxMaster
I want to put an external page(one that I do not control) into an iframe. I then want to track what link they used to leave that website. Please advise. I have been researching but I am stuck now.
Code: Select all
whatever.html, just use a link like the following:
<a href="you.php?param=http://yo.com">Go</a>
And in yo.php, do something like:
$link = $_GET['param'];
// assume database connection
$dbh=mysql_connect ("localhost", "<un>", "<pwd>");
mysql_select_db ("<database>");
$query = "insert into sample (idx,link) values('','$link')";
$result = mysql_query($query);
header("Location: $link");
Will something like this work? What would you do if you wanted to mask the visible "extended URLs"?
Re: external iframe, track exit link
Posted: Wed Jun 28, 2006 2:29 pm
by aerodromoi
LinuxMaster wrote:I want to put an external page(one that I do not control) into an iframe. I then want to track what link they used to leave that website. Please advise. I have been researching but I am stuck now.
Code: Select all
whatever.html, just use a link like the following:
<a href="you.php?param=http://yo.com">Go</a>
And in yo.php, do something like:
$link = $_GET['param'];
// assume database connection
$dbh=mysql_connect ("localhost", "<un>", "<pwd>");
mysql_select_db ("<database>");
$query = "insert into sample (idx,link) values('','$link')";
$result = mysql_query($query);
header("Location: $link");
Will something like this work? What would you do if you wanted to mask the visible "extended URLs"?
php:
Just to explain the principle: Once a user's got an html link displayed in his/her browser, it's out of your reach...
Of course, if you're able to modify the html the user gets, you can implement a redirection script in order to determine which links are most favoured by users. But as this is an external page...
javascript:
You'd need to access the iframe using a javascript function and rewrite the links so that they point to a redirection script on your server...
Please correct me if I'm wrong, but what do you need
that for?

Posted: Wed Jun 28, 2006 2:45 pm
by LinuxMaster
Random websites will be opened in an iframe. Each of those sites uses Google Adsense. I need to track if they clicked one of the Adsense links or if they atleast left the page via a google.com subpage. Adsense are actually in their own iframe, so depending on the method of my tracking, I might need to track within two iframes.
ughh.....