Migrating v3.0 generateAdCode to 4.1

88 views
Skip to first unread message

Darian Shimy

unread,
Nov 30, 2012, 6:04:22 PM11/30/12
to adsen...@googlegroups.com
We are in the Adsense Host program and are in the process of migrating to the new API.  With the old version we called generateAdCode for each publisher, however, aside from the google_ad_client field, the return value was always the same.

The user already authorized us a the host and we do not use ad units.

Since I already have the google_ad_client value, can I generate the ad code from a static template?

Make sense?

Group Participant

unread,
Dec 3, 2012, 2:56:15 AM12/3/12
to adsen...@googlegroups.com
v4.1 appears to add an attribute called "google_ad_slot" which changes every time you generate a tag.  Since that attribute doesn't look to be static, I would guess that, if you had a template, both the google_ad_slot and the google_ad_client would need to be replaced.

2012年12月1日土曜日 8時04分22秒 UTC+9 Darian Shimy:

poll bigger

unread,
Dec 1, 2012, 7:05:40 AM12/1/12
to adsen...@googlegroups.com
yes

--
You received this message because you are subscribed to the Google Groups "AdSense API Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/adsense-api/-/ticudwOQ3jkJ.
To post to this group, send email to adsen...@googlegroups.com.
To unsubscribe from this group, send email to adsense-api...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/adsense-api?hl=en.

Sérgio Gomes (AdSense API Team)

unread,
Dec 3, 2012, 9:09:09 AM12/3/12
to adsen...@googlegroups.com
That's correct. The new Host API uses ad units (aka ad slots), so you'll need to make sure both of these properties are correct, and that the ad unit in question matches the sizes described in the template as well.

Also, don't forget google_ad_host for your revenue share!

Here is some sample generated code:

<script type=\"text/javascript\"><!--
google_ad_client = \"ca-pub-xxxxxxxxxxxxxxxx\";
google_ad_host = \"ca-host-pub-yyyyyyyyyyyyyyyy\";
/* Ad Unit x */
google_ad_slot = \"zzzzzzzzzz\";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type=\"text/javascript\"
</script>

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

Filippo Silvestro

unread,
Dec 4, 2012, 5:11:53 AM12/4/12
to adsen...@googlegroups.com
Is there a guide or some examples that show how to create ad units? I'm trying with the Api Explorer, but I always get the error "Supplied ad unit is missing one or more required values" or "Invalid value".
I can't find in the documentation the allowed values for each field and which ones are compulsory.

Sérgio Gomes (AdSense API Team)

unread,
Dec 4, 2012, 9:09:15 AM12/4/12
to adsen...@googlegroups.com
Hi Filippo,

Here are the samples for Java, we hope to have them for other languages soon:

And the direct sample you're interested in, from the repository:

We'll be adding these values to the docs as well, once we iron out a few issues with our automatic generation.

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

Darian Shimy

unread,
Dec 4, 2012, 8:48:59 PM12/4/12
to adsen...@googlegroups.com
My preference would be to use the old style code.  This is what we use today:

<script type="text/javascript"><!--
google_ad_client="pub-YYYY";
google_ad_host="pub-XXXX";
google_alternate_color="003366";
google_ad_width=250;
google_ad_height=250;
google_ad_format="250x250_as";
google_ad_type="text";
google_color_border="6699CC";
google_color_bg="003366";
google_color_link="FFFFFF";
google_color_url="AECCEB";
google_color_text="AECCEB";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

As you can see, there is nothing other than the google_ad_client that needs to change.  We are not interested in the added reporting features that come with the Ad Units.  Will this continue to work in the new system?

Sérgio Gomes (AdSense API Team)

unread,
Dec 5, 2012, 4:59:22 AM12/5/12
to adsen...@googlegroups.com
Hi Darian,

Old-style ad code will continue working, yes; ads will still be displayed and revenue will still be shared correctly. As you point out, though, certain new features (like publisher-side reporting) will not work, though, as well as any new features we may add in later versions that depend on ad units.

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


Reply all
Reply to author
Forward
0 new messages