無料ブログ各社のGoogle™AdSense設置試験用スクリプト説明
2014/11/22
この投稿に有意義な情報はありません。
各社無料ブログに対してGoogle™AdSenseを設置するにあたって、
擬似的にGoogle AdSenseを表す画像を表示する為の、
JavaScriptテストソースの説明です。
実際にこのソースで何か有意義な結果が得られることはありません。
はじめに
本物で試すのは避けたい
Google AdSenseの設置を試すにあたって、
実際のGoogle AdSenseコードをサイト内に設置して動作を確認するのもいいでしょう。
しかし、Google AdSenseには、
1サイトで3個まで(広告ユニットの場合)などの表示数制限があります。
通常利用しているドメイン以外で自らのアカウントで広告表示を行った場合に、
広告の許可・不許可を求められる場合があります。
要は本物のGoogle AdSenseコードで設置位置などの確認をするのは、
あまり勧められないわけです。
擬似的にスクリプトで確認
そこで、個人的にサイトを確認する際の試験コードを作成して、
各無料ブログから呼び出し、擬似的に画像表示にて動作の確認をしています。
これは、そのご説明用の投稿です。
下記のソースを参照し、閲覧者様のサイトに設置しても、
画像表示としては動作すると思いますが、
一時的に試すなどのテスト以外には直リンクは原則お断りします。
一時的に設定した場合には、速やかに削除をお願いします。
実装方法
スクリプトの処理と読み込み
まず、Google AdSense用の画像を表示するための関数を外部ファイル化し、
利用するブログ側で読み込みを行っています。
1 |
<script type="text/javascript" src="http://algorhythnn.jp/pblic_js/algorhythnn_gad_img.js"></script> |
参照するJavaScriptファイルは以下のようなソースです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
/** * GoogleTM AdSenseの各広告ユニットサイズの画像表示を行います。 * disp_ad("rectangle_mid_300-250");形式で読み込みます。 **/ function disp_ad(p_para){ switch (p_para) { case "rectangle_mid_300-250": document.write('<div>'); document.write('<p>推奨 300x250 - レクタングル(中)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/01_rectangle_mid_300-250.gif">'); document.write('</div>'); break; case "banner_big_728-90": document.write('<div>'); document.write('<p>推奨 336x280 - レクタングル(大)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/02_rectangle_big_336-280.gif">'); document.write('</div>'); break; case "banner_big_728-90": document.write('<div>'); document.write('<p>推奨 728x90 - ビックバナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/03_banner_big_728-90.gif">'); document.write('</div>'); break; case "skyscraper_wide_160-600": document.write('<div>'); document.write('<p>推奨 160x600 - ワイドスカイスクレイパー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/04_skyscraper_wide_160-600.gif">'); document.write('</div>'); break; case "banner_mobile_320-50": document.write('<div>'); document.write('<p>推奨 320x50 - モバイルバナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/05_banner_mobile_320-50.gif">'); document.write('</div>'); break; case "banner_large_970-90": document.write('<div>'); document.write('<p>その他横長 970x90 - ラージビックバナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/06_banner_large_970-90.gif">'); document.write('</div>'); break; case "banner_normal_468-60": document.write('<div>'); document.write('<p>その他横長 468x60 - バナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/07_banner_normal_468-60.gif">'); document.write('</div>'); break; case "banner_normal_468-60": document.write('<div>'); document.write('<p>その他横長 234x60 - ハーフバナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/08_banner_half_234-60.gif">'); document.write('</div>'); break; case "skyscraper_normal_120-600": document.write('<div>'); document.write('<p>その他縦長 120x600 - スカイスクレイパー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/09_skyscraper_normal_120-600.gif">'); document.write('</div>'); break; case "banner_vertical_120-240": document.write('<div>'); document.write('<p>その他縦長 120x240 - 縦長バナー</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/10_banner_vertical_120-240.gif">'); document.write('</div>'); break; case "banner_vertical_120-240": document.write('<div>'); document.write('<p>その他縦長 300x600 - スカイスクレイパー(大)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/11_skyscraper_big_300-600.gif">'); document.write('</div>'); break; case "square_normal-_250-250": document.write('<div>'); document.write('<p>その他スクエア 250x250 - スクエア</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/12_square_normal-_250-250.gif">'); document.write('</div>'); break; case "square_small-_200-200": document.write('<div>'); document.write('<p>その他スクエア 200x200 - スクエア(小)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/13_square_small-_200-200.gif">'); document.write('</div>'); break; case "rectangle_small_180-150": document.write('<div>'); document.write('<p>その他スクエア 180x150 - レクタングル(小)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/14_rectangle_small_180-150.gif">'); document.write('</div>'); break; case "button_125-125": document.write('<div>'); document.write('<p>その他スクエア 125x125 - ボタン</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/15_button_125-125.gif">'); document.write('</div>'); break; case "linkunit-h_big_728-15": document.write('<div>'); document.write('<p>リンクユニット 728x15 - 横長(大)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/17_linkunit-h_big_728-15.gif">'); document.write('</div>'); break; case "linkunit-h_mid_468-15": document.write('<div>'); document.write('<p>リンクユニット 468x15 - 横長(中)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/18_linkunit-h_mid_468-15.gif">'); document.write('</div>'); case "linkunit-v_vbig_200-90": document.write('<div>'); document.write('<p>リンクユニット 200x90 - 縦長(特大)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/19_linkunit-v_vbig_200-90.gif">'); document.write('</div>'); break; case "linkunit-v_big_180-90": document.write('<div>'); document.write('<p>リンクユニット 180x90 - 縦長(大)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/20_linkunit-v_big_180-90.gif">'); document.write('</div>'); break; case "linkunit-v_mid_160-90": document.write('<div>'); document.write('<p>リンクユニット 160x90 - 縦長(中)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/21_linkunit-v_mid_160-90.gif">'); document.write('</div>'); break; case "linkunit-v_small_120-90": document.write('<div>'); document.write('<p>リンクユニット 120x90 - 縦長(小)</p>'); document.write('<img src="http://algorhythnn.jp/blg/wp/wp-content/uploads/2013/09/22_linkunit-v_small_120-90.gif">'); document.write('</div>'); break; default : document.write('<div>'); document.write('<p>パラメータに誤りがあります</p>'); document.write('</div>'); break; } } |
スクリプトの実行
スクリプトの実行処理は、
各無料ブログ側のHTML編集やブログパーツへのスクリプト設定にて行います。
以下のように記述することで、パラメータで指定したファイル名の
画像ファイルを表示します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<script type="text/javascript"> disp_ad("rectangle_mid_300-250"); disp_ad("banner_big_728-90"); disp_ad("banner_big_728-90"); disp_ad("skyscraper_wide_160-600"); disp_ad("banner_mobile_320-50"); disp_ad("banner_large_970-90"); disp_ad("banner_normal_468-60"); disp_ad("banner_half_234-60"); disp_ad("skyscraper_normal_120-600"); disp_ad("banner_vertical_120-240"); disp_ad("skyscraper_big_300-600"); disp_ad("square_normal-_250-250"); disp_ad("square_small-_200-200"); disp_ad("rectangle_small_180-150"); disp_ad("button_125-125"); disp_ad("linkunit-h_big_728-15"); disp_ad("linkunit-h_mid_468-15"); disp_ad("linkunit-v_vbig_200-90"); disp_ad("linkunit-v_big_180-90"); disp_ad("linkunit-v_mid_160-90"); disp_ad("linkunit-v_small_120-90"); </script> |
上記の処理を呼び出した例は以下のようになります。
さいごに
こうした方法で動作確認をおこなっておりますので、ご参考まで。
Google™はGoogle Inc. の登録商標(第4478963号及び第4906016号)です。
GoogleロゴはGoogle Inc. の国際登録商標です。
国際登録番号:881006及び926052及び1086299及び1091990及び1145934
Google AdSense™,AdSense™はGoogle Inc. の登録商標(第4899412号)です。
Google Analytics™はGoogle Inc. の商標です。
関連記事
-
GoogleAdSenseポリシーを準拠した404ページに対する対応
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
(投稿前後)WordPressにGoogle™AdSenseサイト内検索(カスタム検索エンジン)を設置する方法
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
無料ブログに対してGoogle™AdSense広告を表示する危険性とリスク
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
忍者AdMax™配信広告にアダルト広告が表示された場合の対処法
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
Google™AdSenseに問い合わせを行う連絡先(窓口)を『みんなのお陰で』こじ開けられた!
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
Google™AdSenseの検索向けユニット(サイト内検索・カスタム検索エンジン)の設定とデザイン
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
GoogleAdSense導入サイトではZenbackの利用は難しそうだ
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
【再投稿】投稿の前後挿入にPost6WidgetArea_v0.6.2-wordpressプラグインを利用
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
Google™AdSenseと他社広告の共存は問題ない
Google or AdMax Promotion(it) 禁断の機能がau公式 …
-
Googleのディスプレイ広告(たぶん)がYoutubeと融合していて深キョンが可愛過ぎた件
Google or AdMax Promotion(it) 禁断の機能がau公式 …