473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How does Google show_ads.js work?

Hi

I'm hoping to set up a system similar to Google Adwords that allows
other sites to extact a limited amount of data from my site, and
display it as part of their webpage. Google use a javascript file:
show_ads.js with parameters.
Can anyone explain how the .js file works? In particular how does it
output HTML back to the calling site, and how does it access the
parameters?

Cheers

John South
www.WhereCanWeGo.com

Jun 23 '06 #1
1 6185
On Fri, 23 Jun 2006 02:41:45 -0700, JohnSouth wrote:
Hi

I'm hoping to set up a system similar to Google Adwords that allows
other sites to extact a limited amount of data from my site, and
display it as part of their webpage. Google use a javascript file:
show_ads.js with parameters.
Can anyone explain how the .js file works? In particular how does it
output HTML back to the calling site, and how does it access the
parameters?


You can "fake" javascript file content. You write a cgi that returns valid
javascript and specify this as the source of the <script> tag eg (untested)

In html document:
....
<head>
<script type="text/javascript" language="JavaScript"
src="http:/www.yoursite.com/cgi-bin/js.pl"></script>
....

in js.pl:

#!/usr/bin/perl

use CGI qw(&header &cookie);
use strict;
use warnings;

my $cookie1 = cookie('cookie1');
print header('text/javascript');
print qq(var cookie1 = '$cookie1';);

Extending this idea, you can also have your "fake" javascript file return
html into valid javascript and place the script tag in your document body
at the place you want it printed eg.

<body>
....
<script type="text/javascript" language="JavaScript"
src="http:/www.yoursite.com/cgi-bin/js.pl"></script>
....
</body>

and in js.pl:

#!/usr/bin/perl

use CGI qw(&header);
use strict;
use warnings;

print header('text/javascript');
print <<EOT;
document.write('blah blah blah');
document.close();
EOT

HTH
Rich
Jun 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Ram Laxman | last post by:
I have used vector in the VC++ compiler. I have included #include <string> #include <algorithm> #include <vector> std::vector<int> field; std::vector <int>::size_type i;
3
by: Antonio | last post by:
Good Morning, I would want to insert the javascript of google adsense in my site, here it is : <script type="text/javascript"><!-- google_ad_client = "pub-4902392511135327"; google_ad_width =...
10
by: BlueDolphin | last post by:
I'm not sure if this is a question or more of a rant... but I'm looking for some input on this from other developers out there. How often has the following happened to you and how have you dealt...
44
by: Bamber | last post by:
Why does f get returned ? (compiled with gcc). #include<stdio.h> int func(int a); main() { int f; f=func(7); printf("f=%d",f);
6
by: foldface | last post by:
Hi Sorry, don't know how to phrase the question any better. Within Visual Studio I have a style sheet that being dynamically added to the code, i.e. not via the html page. I want to place this...
7
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted...
4
by: Alan Silver | last post by:
Hello, Seems everyone's site nowadays has those "Ads by Goooooogle" boxes on them. I would like to do something similar, so I can provide an affiliate scheme. I don't want to supply HTML for...
2
by: Jim Carr | last post by:
Upon entering the site www.FutureByDesign-Music.com with IE6, my clipboard is erased and then disabled in all other Windows XP applications. Navigating to another site returns clipboard...
1
by: exoplast | last post by:
google adsense code uses ()() as its main body. http://pagead2.googlesyndication.com/pagead/show_ads.js (i have used http://www.prettyprinter.de to simply the code) ( function() {} )() what...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.