Adsense cannot be used with Xojo Web

I am wondering how to embed adsense into a Xojo Web app.

There is a thread on the old forum that indicates that this is a fools errand.

Anyone have a brilliant work around?

Do you happen to have a link to the API docs? I can’t seem to get to them without signing up for an account.

You will need a test account anyways, just to check that your experiments works. It costs nothing. :slight_smile:

The API’s entry page is here:

As for an account creation, go here:

Anybody had succeeded working with google ad-sense?

Hoping that this will be revived.

Done it! :slight_smile:

I’ve been programming in Xojo for about a year and I’ve kinda left this final obstacle for later.
Now that my website is almost complete I’ve spent about a month tinkering with AdSense before I succedeed.

For starters, new Google’s automatic vetting process is flawed. If you submit anything that fires up .cgi you will fail. I should know, I’ve tried it several times with .cgi, full page frame pages with redirects and whatever else I could think of. Their 3 days waiting period often stretched to 8-10 days. Therefore my attempts were days apart.

Finally I’ve decided to game the system. I’ve placed a flat html index page with some semi-related content (no cms, links or whatever) and voilla, I was AdSense worthy in a day. Then I’ve changed the index.html like this:



And In my Xojo App I use a weblabel (with fixed size else anchored on two points - or else I got smaller adsense unit shown then the desired weblabel size) that opens an iframe (for the ease of testing - this way I could change my adsense related code without recompiling):

mylabel.text = "<raw><p><iframe frameborder=""0"" width=""250px"" min-height=""600px"" height=""650px"" src=""adse.html""></iframe></p></raw>"

Notice the relative path - doesnt work without it. My adse.html file is in a a folder where my .cgi app is. If you use hashtags with /# instead of just # frame will not load beacause of relative paths. Also size is vertical beacuse I needed vertical banners for the sides of my website.

Contens of my adse.html is a gener AdSense generated code:



I load it in my resized event (Unsure if this is the best way).
It works nicely, pageviews andimpressions are shown and calculated just as well as on any other website.

I work on my AdBlock detection now.

Hope that was clear enough. Good luck, and now that people know it could be done I expect refinements and a better way of doing AdSense.

Changed my iframe loading code for AdSense to this iframe replacement code:

mylabel.text = "<raw><p><object data=""adse.html"" type=""text/html""></object></p></raw>"

All standard width, height, frameborder and any other properties may be used, ofc.

According to what I’ve read this method will not block onload event, and, according to my limited testing - whole page loads quite a bit faster while AdSense works flawlessly.

@Vitomir Savic Thanks. After 5 years my question is answered! I just hope that web 2.0 wont break it!

Web 2.0 is a complete rewrite
Xojo has said this several times
So the likelihood you will be able to keep your existing code without changes is low
And that means you may have to solve this issue once again when Web 2.0 ships