Re: Having issues embedding an ad unit's code I get from AdSense Host API into my website

80 views
Skip to first unread message

Sérgio Gomes (AdSense API Team)

unread,
Jan 3, 2013, 7:05:35 AM1/3/13
to adsen...@googlegroups.com
Hi Ronen,

Let me answer your questions by number:

1. The 400 errors are likely because these are sandbox accounts, yes. I'm not entirely sure what mechanism is used to prevent them from serving, but I know they will not serve ads (since they're only for testing). The fact that you say the API call is working correctly seems to validate this.

2. It's always best to create the ad unit with your preferred style (the one you'll be using most of the time). You could then later override it when generating the ad code, in case there's a property you need to change, but we don't currently make this functionality available through the API, so you'd have to parse and modify the generated ad code (which is a bit icky). As for size, that cannot be overridden since it has the potential to affect page rendering (which is why we won't let you change it once you create the ad unit), so you need a separate ad unit in that case.

3. Ah, that's incorrect, it should be "SLIGHTLY_ROUNDED", not "ROUNDED". I'll try to get that page fixed.

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


On Thursday, 3 January 2013 07:54:24 UTC, ron...@codeoasis.com wrote:
Hi everyone,

I'm working on an application that integrates with Google's AdSense host API's services. I'm having some problems getting a complete flow. So far I have a user without an AdSense account. I redirect that user to the redirect URL I got by calling associationsessions.start (as described here). That user is then requested to go through the process of signing up to AdSense. After that user has finished it gets back to my website, I verify the token and get it's publisher's Id.

The user didn't had to wait for approval though, and it instantly got a (what seems to be) functional AdSense account. Here are the problems I'm having: 
  1. I'm able to create new ad units for that user through the AdSense host API and can get a list of all ad units I created for that user. However, when I try to get the code for an ad unit through the getAdCode method (as described here) I'm getting a 400 error code (bad request) from Google (I get the code without any problems, but I'm getting JavaScript errors when I put the code I get into a HTML page).
    I also created a new ad unit with that user (not through the AdSense host API) and then tried to put the code I get manually and I still got the same 400 error.
    I checked (through the accounts: get method) and the user's status is set to APPROVED. Is this something that's related to the AdSense host API? or is it something I'm doing wrong?
    I know for a fact it's not anything related to the HTML page I put the code in, because if I only change some of the JavaScript configuration parameters (such as google_ad_client) to different ones, I would get a working ad unit.
  2. I can see that the code I get from AdSense can be customized with different colors and fonts with JavaScript parameters (such as: google_color_bg, google_ad_type, etc) and I can also change an ad unit's style by editing it through the AdSense host API. Which way is better if I want to customize a user's ad unit? Is there a way to get a customized JavaScript code through the AdSense API?
    Also, I can see that I can't change the size of an ad unit one it's created (I'm getting a message that the size property is read only back from the API). Does this mean that the only way I can have an ad unit presented in different sizes is by editing the JavaScript configuration I get by calling 
    getAdCode?
  3. This looks like a bug: I can edit an ad unit's corner style to SQUARE and VERY_ROUNDED but I can't edit it to ROUNDED (described here). Trying to update an ad unit's corner style to ROUNDED won't throw any exceptions from the API and I'm getting a success message from the API but the value is set to null instead of ROUNDED.
Could some of these problems relate to the fact that I'm using a sandbox account (only as a host, I tried signing up to ad sense through my host as a newly created Google account)?

Thanks in advance, Ronen.

Sérgio Gomes (AdSense API Team)

unread,
Jan 3, 2013, 7:49:11 AM1/3/13
to adsen...@googlegroups.com
Hi Ronen,

Once you go live, your existing (production) AdSense account will be enabled for Host functionality. Publisher accounts created with that one will be production AdSense accounts, which are able to serve ads. I'm afraid there's no way for you to test this now, unless you're already an existing host, using v3. :-/

Oh, as a sidenote, you should keep the sandbox account even after you go live, so that you have a test account if you ever want to develop new features!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902

On Thursday, 3 January 2013 12:22:39 UTC, ron...@codeoasis.com wrote:
Hi Sérgio,

Thanks for your quick answer.

One more question please. Once I go to production (or now if I only want to make sure displaying ads really do work), how can I have a host account that can actually display ads? I understand that a sandbox account is for testing, but how can I get a hold of an account that can be used for production?

Thanks again,
Reply all
Reply to author
Forward
0 new messages