FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Did You Click on a Link on My Site

 


Possum
Hi

On my Site How can I tell if someone has clicked on a link that leads to a outside URL?

Thank you..
Peterssidan
I don't think you can. Maybe it's possible by using javascript in some way.
What do you need to know that for?
Possum
I am studying advertising

On my site I have links to outside sites.

If I can record the click thrus from my site I may be able to gauge advertising revenue. Just like Google does.

Thank you
Peterssidan
Can't you use google analytics for that? If you are using google analytics take a look at "Top Exit Pages". "Site Overlay" might also be useful.
Possum
You are most likely correct. But they use methods that I would like to know about..
sonam
Maybe you can use php redirecting. All your links will go on same php page (script). From there with switch you can write counting (and other) data in MySql or Flat File and then redirect to the right external page. I think this is the simplest way for your needs.

Sonam
imagefree
if you can control the link submission/advertisement then u can count the clicks.

I dont know what kind of advertising system you are talking about. If you have a system like Adsense, then you can count the clicks by saving all the links into a table in database and assign an ID to each link. Then create your site links like

Code:
http://www.your-example-site.com/ad.php?id=123456


the script ad.php could record the click and then forward the user to the address already saved to database against the ID 12345.

GOt it?
polly-gone
If I were you, I'd use a simple PHP script to do that.

When you made a link, the HREF part of it would look something like this:

Code:
http://example.com/redirect.php?url=http://someurl.net


The Script for redirect.php would do something to record the click (like submit it to a database) and it would use what is contained in ?url= to forward the person to that page.

-Nick Cool Exclamation Very Happy
chiragpatnaik
A very simple way would be to use Google Analytics. They have a scriptlet which uses onclick() to call an event.

The event is your outbound click.
snowboardalliance
Yes just use Google Analytics or some pre-made software for analysis. It is possible to DIY but software already exists for it
babarus
I think u can use same php code.

Confused
rajpk
u can keep track of

mean count nimber of clicks whan a link

just php code

simply whaen abc.com cliks a count is increamentes by one

thats all
Damascus_Steel
You can use PHP and a MySQL database to track how someone clicked an ad.

Instead of the link going to the page itself, have it go to a page where it ads 1 to the number of times it's been clicked. Then redirect to the page advertised.

Like this:

heres ad.html:

Code:

<a href='ad1.php'>Ad1</a><br>


and heres ad1.php

Code:

<?
$sql = mysql_query("SELECT * FROM `ads` WHERE `adname` = 'ad1'");
$sql = mysql_fetch_assoc($sql);
$count = $sql['adcount']+1;
mysql_query("UPDATE `ads` SET `adcount` = '$count' WHERE `adname` = 'ad1'");
?>
<script language='javascript'>
window.location = 'the_ad.html';
</script>


Your could try that...
jmraker
Here's a better way to do what Damascus_Steel's code does

Code:

<a href='ad.php?id=1'>Ad1</a><br>


Code:

<?php
... connect to database ...
if(isset($_GET['id'])){
  mysql_query('UPDATE ads SET ad_count=ad_count+1 WHERE ad_id=' . $_GET['id']);
  if(mysql_affected_rows() > 0){
    $res = mysql_query('SELECT * from ads WHERE ad_id=' . $_GET['id'] . ' LIMIT 0,1');
    $rec = mysql_fetch_array($res, MYSQL_ASSOC);
    header('Location: ' . $rec['ad_url']);
  }
}
header('Location: /index.php');
?>
Related topics

What's Wrong with Making Money?
Some not so commonly asked questions.
Link exchange with my site!
URGENT help with file
How do you generate forum traffic?

Link to frihost
Big guide to FREE programs!
Inflated disk usage
Looking for link exchange partners
Google Adsense - *OFFICIAL THREAD*

Directory submissions opened
Me! What do ya think?
How long have you gone without sleep?
How to add your site to search engines
AIM Virus.

xXx link site
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.