google_ad_slot Must be String

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

I just wasted probably two maybe even three hours discovering that when writing an Adsense manager in Javascript, you MUST make sure your google_ad_slot values are string literals and not integers.

For example the following will behave as expected.

JAVASCRIPT Code: [ Select ]
display = function(slot)
{
    window.google_ad_slot = slot;
    // ...
}
 
var my_slot = "1234567890";
 
display(my_slot);
  1. display = function(slot)
  2. {
  3.     window.google_ad_slot = slot;
  4.     // ...
  5. }
  6.  
  7. var my_slot = "1234567890";
  8.  
  9. display(my_slot);


However if you change one line, and remove the quotes from "my_slot" so that it's an int instead of a string like so,

JAVASCRIPT Code: [ Select ]
var my_slot = 1234567890;


You'll get absolutely no error messages, and have no clue why trying to display multiple units using the same slot_id never displays more than one unit.

That's right, if you don't use a string literal for google_ad_slot for some strange reason Adsense will only display one ad unit.
  • dark_lord
  • Graduate
  • Graduate
  • User avatar
  • Posts: 162
  • Loc: India-Kolkata

Post 3+ Months Ago

and sometimes they ruin my mobile sites. They throw one line ads which doesn't follow wml.

like example an ad given on mobile site

<a href="something...">FAST&FURIOUS</a>

now that & is not valid in wml doctype it should be re written as &amp; while it works with xhtml but no luck with wml. I had to finally remove google adsense from my wml section. It's really bothering.

In that case, Admob is pretty good in business but recently i heard that Google took over them. So again i fear lol
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Don't the mobile ads go through PHP on your server, meaning you could clean up the output before sending them to your visitors ?

I can't remember, I ended up skipping the mobile-specific stuff and focused on smartphone browsers like Safari and Opera. Makes my life easier. :)
  • dark_lord
  • Graduate
  • Graduate
  • User avatar
  • Posts: 162
  • Loc: India-Kolkata

Post 3+ Months Ago

joebert wrote:
Don't the mobile ads go through PHP on your server, meaning you could clean up the output before sending them to your visitors ?



didn't thought on that, :lol: i should check their code probably.

thanks anyway

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 20 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.