Once you have created a publisher ad unit of yours in your Google AdSense account you can further customize it on-the-fly by modifying parameters in its script.
A Google AdSense ad script is a Javascript one, where you can insert new options or change the value or others already set on script creation.
For instance, this is a an example Google AdSense script:
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-9432192248342325″;
/* 160×600 text/image, created 06/12/08 */
google_ad_slot = “1403149691″;
google_ad_width = 160;
google_ad_height = 600;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
The ad was set from the beginning to allow both text and image ads.
What if for any reason you wish AdSense to display for a while only text ads instead?
That can be done by inserting into the script the following line of code:
google_ad_type = “text”;
the full script so becoming:
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-9432192248342325″;
/* 160×600 text/image, created 06/12/08 */
google_ad_slot = “1403149691″;
google_ad_width = 160;
google_ad_height = 600;
google_ad_type = “text”;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
Should you conversely desire AdSense to show only image ads, then you have to change the same google_ad_type parameter value to “image” (image ads include reach media ads as well). Therefore:
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-9432192248342325″;
/* 160×600 text/image, created 06/12/08 */
google_ad_slot = “1403149691″;
google_ad_width = 160;
google_ad_height = 600;
google_ad_type = “image”;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
In the case you originally created your ad unit for text only or image only ads, to afterwards have it to randomly and automatically display text and image ads you must insert or modify the google_ad_type parameter value to “text_image”:
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-9432192248342325″;
/* 160×600 text, created 07/12/08 */
google_ad_slot = “1403149691″;
google_ad_width = 160;
google_ad_height = 600;
google_ad_type = “text_image”;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
Alternatively, you can modify your ad unit from inside your Google AdSense account, but such modification would apply to any page/location where you have used that ad unit.
By modifying the script code as explained above, you can instead obtain greater flexibility, in that you can change the ad unit behaviour just on the pages and locations where you deem it opportune.