28, May 2012

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

 
Webdigity webmaster forums
[ 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
Instabuck - The easy way to sell digital products online

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



« on: Sep 18, 2006, 07: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


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



« Reply #1 on: Sep 18, 2006, 07: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Sep 18, 2006, 09: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>

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #3 on: Sep 18, 2006, 10: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Sep 18, 2006, 10: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, 10:26:01 pm by olaf »

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #5 on: Sep 18, 2006, 10: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #6 on: Sep 18, 2006, 10: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

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #7 on: Sep 18, 2006, 10: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 or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Sep 18, 2006, 10:39:27 pm »

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

aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



« Reply #9 on: Sep 18, 2006, 11:30:46 pm »

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


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



« Reply #10 on: Sep 18, 2006, 11:32:39 pm »

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 or twitter

Last blog : Butterfly Marketing 2.0
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



« Reply #11 on: Sep 18, 2006, 11:37:41 pm »

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


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, 08: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, 10:37:32 pm »

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


It's time to use PHP5!


« Reply #14 on: Oct 31, 2006, 10:59:30 pm »

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

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

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #15 on: Nov 01, 2006, 08: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 or twitter

Last blog : Butterfly Marketing 2.0
OMG!I am geek
**
Gender: Male
Posts: 55
366 credits
Members referred : 0


my day will come..


« Reply #16 on: Nov 01, 2006, 07: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, 07: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, 01: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: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #18 on: Nov 02, 2006, 06: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>

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....

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?
May 28, 2012, 02:23:36 pm





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!






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