Save everyone tons of time with GEO Targeting

amber0855

Junior Member
Joined
Feb 4, 2009
Messages
196
Reaction score
104
I noticed all of the craziness with databases, php files and other bs that everyone is employing to GEO target. I thought that there has to be a better way, and I found it. This is a simple Javascript that pulls the info from google and shows it on your page. I did not write this script, I just found it posted and wanted to save some peeps alot of time and trouble. Here it is:

<script type="text/javascript" src="http://www.google.com/jsapi"> </script>
<script type="text/javascript">
if (typeof(google.loader.ClientLocation.address.city) != null) {
document.write(google.loader.ClientLocation.address.city
+", "
+google.loader.ClientLocation.address.region);
} else {
document.write("Unknown location")
}
</script>

Just paste it in your HTML page and let it do the work! :D
Cheers
 
can you be more specific, i tried putting on my page and shows nothing?
 
There is an odd space in the address part:
HTML:
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"> </script>
<script type="text/javascript">

	if (typeof(google.loader.ClientLocation.address.city) != null) 
	{
		document.write(google.loader.ClientLocation.address.city+", "+google.loader.ClientLocation.address.region);
	} 
	else 
	{
		document.write("Unknown location")
	}
</script> 
</head>
<body>
</body>
</html>
 
Ok, here is a tutorial to post this:

Open the source code of the html page that you are using... dreamweaver or whatever. In the tag where you have something like "Meet sexy girls in (insert script here)".

Here is the demo page at date-a-millionaire.com/10.html

You can also view the source info there.

If for any reason google cannot locate your ip, it should display "Unknown location". You can also change this in the script.

Thanks Fatboy, for some reason the BHW forums may have added the space. I just copied and pasted it here from my working version.
 
Last edited:
Sure is... I just re-up the demo with various fonts and colors.

You can even make the reply font , color and size different than surrounding text if you want.

I changed the demo, showing different colors and sizes. Just view the page source

date-a-millionaire.com/10.html

Cut and strip the javascript. I also changed the variations to show only the city or only the state. The codes are all there.
 
Last edited:
cool.. is there a chance we can change the font and the color of the text?

Here's one way to do it:

Code:
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"> </script>
<span style="color:blue;font-family:Verdana">
<script type="text/javascript">

	if (typeof(google.loader.ClientLocation.address.city) != null) 
	{
		document.write(google.loader.ClientLocation.address.city+", "+google.loader.ClientLocation.address.region);
	} 
	else 
	{
		document.write("Unknown location")
	}
</script> 
</span>
</head>
<body>
</body>
</html>
 
Back
Top