lately, I made one of my Apps free (SpeakToMe,http://the-crying-eye.com/SpeakToMe), and added Advertising using AdSense to refinance it

Since Sunday - two days ago - 41 people downloaded it from my site. And some of them seem to click on the advertising inside the Window. At the moment, it shows Advertising about quads, those 4-wheeled-fun-mounts... Don't know, where Google gets the Info about me sticking to quads, but ok.

So, I'd like to share my findings

You will need an account over at Google Adsense, and about 1k on your own webspace for every ad-campaign you like to set up.
Then - in AdSense - set a campaign for online-content, get the appropriate ID and your publisher-id. You can use these two files:
Part 1: PureBasic-Code, self contained. This works on Mac OS X
Code: Select all
; AdSentified - means AdSense in your Desktop-Apps!
; made by The Crying Eye
; use it, share it, give credit (if you like)
; donate to some international organization planting trees :-)
; comments welcome
EnableExplicit
Global URLgotshot = 0
Global threadid = 0
Procedure Open_URL(URL$)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_MacOS : RunProgram("open", URL$, "")
CompilerCase #PB_OS_Windows : RunProgram(URL$)
CompilerCase #PB_OS_Linux : RunProgram(URL$)
CompilerEndSelect
EndProcedure
; I need to fake Callbacks here, because PureBasic does not actively support
; CallBacks from WebGadgets on Mac OS X (or I am too stupid to use it)
Procedure NavigationCallback(*value)
Define temp$
Repeat
temp$ = GetGadgetItemText(0,#PB_Web_PageTitle)
If temp$ <> "Apps" And temp$ <> ""
Open_URL(GetGadgetText(0))
URLgotshot = 1
EndIf
Delay(250) ; needs this to stop double or tripleclicks
ForEver
EndProcedure
OpenWindow(0,50,50,468,60,"Adsense")
WebGadget(0,0,0,468,60,"http://domain.com/yourhttpfile.html") ; set the URL and Size accordingly.
threadid = CreateThread(@NavigationCallback(),0)
Repeat
If URLgotshot = 1
SetGadgetState(0,#PB_Web_Back)
URLgotshot = 0
EndIf
Until WaitWindowEvent(1) = #PB_Event_CloseWindow
Code: Select all
<html><head><title>Apps</title></head><body><div style="position:fixed;top:0;left:0;width:486px;height:60px;padding:0;margin:0;overflow:hidden">
<script type="text/javascript"><!--
google_ad_client = "xxx"; // add your publisher-id here
/* Apps */ // you need to set the same name here like in your campaign
google_ad_slot = ""; // add your ad-slot here - the ID of your campaign
google_ad_width = 468; // the same size as in your PB-Code
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></body></html>
I think, this will decline in the future, when less people download my App, but for now... Nice

If you have more question, don't hesitate to ask.
This is hard to figure out, but easy to setup.