24, July 2008

is it possible to track google ad clicks? - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: is it possible to track google ad clicks?
« previous next »
Pages: [1] Print

Author Topic: is it possible to track google ad clicks?  (Read 1410 times)
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« on: Sep 18, 2006, 08:46:58 PM »

is it possible using PHP to track what user clicks on google ads, and when, how many times, etc? before i even try to do this, i want to know if its even possible Smiley at first i do not think it is possible, but you may beg to differ Tongue

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #1 on: Sep 18, 2006, 08:52:40 PM »

It is possible using javascript.

There are some scripts for this thing, but I don't remember one. I think there is a thread in the forum regarding that.

Make a search to see Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Sep 18, 2006, 10:19:13 PM »

I use this code to track link in javascript banners:
Code:

<div id="countMe">
<script type="text/javascript" language="javascript" src="http://www.dom.net/placeholder=11"></script></div>
<script type="text/javascript">
<!--
var banner = document.getElementById("countMe");
banner.onclick = count_link;

function count_link() {
image = new Image();
image.src = "/includes/out.php";
return true;
}
-->
</script>


Last blog : 4th of July Lottery from TemplateMonster.com
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #3 on: Sep 18, 2006, 11:15:35 PM »

If the countMe where you would store the adsense code inside it, would it count the link?

You know like

<div id="countMe"><script ........

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Sep 18, 2006, 11:20:01 PM »

Oh yes I forgot to tell that out.php is the counting script:

Code:
<?php
if (!empty($_GET['id']) && isset($_GET['ref'])) {
$delay 3600;
if (preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/"$_GET['rem_adr'])) {
if (strstr($_GET['rem_adr'], ', ')) {
$ips explode(', '$_GET['rem_adr']); 
$ip $ips[0];
} else {
$ip $_GET['rem_adr'];
}
} else {
$ip "n/a (IPv6 ?)";
}
$ip = (!get_magic_quotes_gpc()) ? addslashes($ip) : $ip;
$sql_check sprintf("SELECT COUNT(*) AS test FROM clicks WHERE link_id = %d AND visitor_ip = '%s' AND UNIX_TIMESTAMP(click_at) + %d > UNIX_TIMESTAMP(NOW())"$_GET['id'], $ip$delay);
if (mysql_result(mysql_query($sql_check), 0"test") == 0) {
$country_sql "SELECT country FROM ip2nation WHERE ip < INET_ATON('".$ip."') ORDER BY ip DESC LIMIT 0,1";
$country mysql_result(mysql_query($country_sql), 0"country");
$sql_insert sprintf("INSERT INTO clicks (link_id, visitor_ip, click_at, country, on_page) VALUES (%d, '%s', NOW(), '%s', '%s')"$_GET['id'], $ip$country$_GET['ref']) or die(mysql_error());
mysql_query($sql_insert);
}
}

the question as about how to click/count not to count clicks, hehe

search ip2nation on google for all the ip addresses
« Last Edit: Sep 18, 2006, 11:26:01 PM by olaf »


Last blog : 4th of July Lottery from TemplateMonster.com
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #5 on: Sep 18, 2006, 11:26:49 PM »

I think with an adsense click counter, you can create much better analysis tools, so it will help you have more clicks Smiley

BTW maxmind has the real ip->country database Wink

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Sep 18, 2006, 11:30:57 PM »

I think with an adsense click counter, you can create much better analysis tools, so it will help you have more clicks Smiley

BTW maxmind has the real ip->country database Wink
I can't follow you... what can be different to count the click on content inside a div? and who is maxmind? Grin


Last blog : 4th of July Lottery from TemplateMonster.com
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #7 on: Sep 18, 2006, 11:34:14 PM »

Hehe just tolled you that because you mentioned ip2country.

maybe I will try to make a click counter some time, but not now, too many projects on progress.....

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Sep 18, 2006, 11:39:27 PM »

buy the way ip2country has updates at least 2 times a year...


Last blog : 4th of July Lottery from TemplateMonster.com
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #9 on: Sep 19, 2006, 12:30:46 AM »

so with this script, where do we use for example the google adsense code?

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #10 on: Sep 19, 2006, 12:32:39 AM »

buy the way ip2country has updates at least 2 times a year...

Inside a div with id="countMe"

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 884
1636 credits
Members referred : 4



« Reply #11 on: Sep 19, 2006, 12:37:41 AM »

ok i am going to actually try this out, and will report here on this thread problems and/or success as usual.. thanks for the help so far guys Smiley you are always so patient with old meth0d Tongue

Visit through proxy Visit through proxy Visit through proxy

Last blog : phpHaze 1.59.1 in Development
OMG!I am geek
**
Gender: Male
Posts: 55
366 credits
Members referred : 0


my day will come..


« Reply #12 on: Oct 31, 2006, 09:09:25 AM »

I'm pretty sure there's got to be another way.
If there's a way to track incoming referers, there's got to be a way to store outgoing references.
But I don't know for sure any way of doing it.
Google has most of the answer I look for anyway.
Try a smart search like:
track+outgoing+links
or something.
peace
OMG!I am geek
**
Gender: Male
Posts: 55
366 credits
Members referred : 0


my day will come..


« Reply #13 on: Oct 31, 2006, 11:37:32 PM »

Maybe this can be useful..
http://www.olate.co.uk/articles/142 Visit through proxy
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #14 on: Oct 31, 2006, 11:59:30 PM »

Maybe this can be useful..
http://www.olate.co.uk/articles/142 Visit through proxy

don't think that this way the clicks from adsense are counted Wink


Last blog : 4th of July Lottery from TemplateMonster.com
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #15 on: Nov 01, 2006, 09:05:24 AM »

Yeah this is usefull only when you want to track outgoing links.

To track the adsense code, you need something that tracks the clicks on a certail div.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
OMG!I am geek
**
Gender: Male
Posts: 55
366 credits
Members referred : 0


my day will come..


« Reply #16 on: Nov 01, 2006, 08:31:48 PM »

 Embarrassed

hehe, then I guess he could put into <DIV> something like:
<DIV onClick="parent.location('counter.php');">
(not real syntaxis)
And into counter.php he could track the clicks (adsense opens a new window when people click on it, true? so counter.php can just count how many times have counter.php been seen).
In counter.php I'd also add into <BODY>
<BODY onLoad="javascript:go.back(-1);">

I think this may work.
« Last Edit: Nov 01, 2006, 08:38:10 PM by eliezer »
OMG!I am geek
**
Gender: Male
Posts: 55
366 credits
Members referred : 0


my day will come..


« Reply #17 on: Nov 02, 2006, 02:47:24 AM »

By the way, the counter.php could be in an invisible 1x1px frame and in a folder protected by .htaccess from remote access to avoid hacking.  Wink
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #18 on: Nov 02, 2006, 07:32:48 AM »

By the way, the counter.php could be in an invisible 1x1px frame and in a folder protected by .htaccess from remote access to avoid hacking.  Wink
Don't think that this is working, I use this code:
Code:
<div id="countMe">
<!-- adsense code here -->
</div>
<script type="text/javascript">
<!--
var banner = document.getElementById("countMe");
banner.onclick = count_link;

function count_link() {
image = new Image();
image.src = "count.php";
return true;
}
-->
</script>


Last blog : 4th of July Lottery from TemplateMonster.com
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4150
Tags : php javascript google forums databases Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: is it possible to track google ad clicks?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 24, 2008, 11:36:14 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.712
Total Topics: 7.376
Total Members: 3.706
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: FortuneBeach

28 Guests, 4 Users online :

12 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.