-
Notifications
You must be signed in to change notification settings - Fork 0
スマートフォンWebサイトへのネイティブ広告の導入について
ネイティブ広告ガイドラインに従って掲載をお願いいたします。
以下はサンプルコードとなります。 実際にはメディアID、枠Noを管理画面から取得し、任意のレイアウトで掲載してください。
<script type="text/javascript">
var adstir_vars = {
ver: "4.0",
type: "native",
app_id: "メディアID",
ad_spot: 枠No,
async: false,
// 書き出すHTMLを設定します。各要素はレスポンス詳細をご覧ください。
native_html: "<a href=\"%%CLICK_URL%%\"><img src=\"%%IMAGE%%\"><br><img src=\"%%ICON%%\"><br>%%TITLE%%<br>%%DESCRIPTION%%<br>%%CTA%%<br>%%RATING%%<br>%%ADVERTISER%%</a><a href=\"%%OPTOUT_URL%%\">オプトアウト</a>"
};
</script>
<script type="text/javascript" src="http://js.ad-stir.com/js/adstir_native.js"></script>
以下はサンプルコードとなります。 実際にはメディアID、枠Noを管理画面から取得し、任意のレイアウトで掲載してください。
<script type="text/javascript">
var adstir_vars = {
ver: "4.0",
type: "native",
app_id: "メディアID",
ad_spot: 枠No,
async: false,
native_callback: function(response){
// 広告レスポンスが正常に取得できた時に行う処理を実装
// レスポンスオブジェクトのついてはレスポンス詳細をご覧ください
document.write("<a href=\""+response.clickUrl+"\">");
document.write("<img src=\""+response.image+"\" class=\""+response.inviewDetectionIdentifier+"\">");
document.write("<br>");
document.write("<img src=\""+response.icon+"\">");
document.write("<br>");
document.write(response.title);
document.write("<br>");
document.write(response.description);
document.write("<br>");
document.write(response.cta);
document.write("<br>");
document.write(response.rating);
document.write("<br>");
document.write(response.advertiser);
document.write("</a>");
document.write("<a href=\""+response.optoutUrl+"\">オプトアウト</a>");
}
};
</script>
<script type="text/javascript" src="http://js.ad-stir.com/js/adstir_native.js"></script>
response.clickUrl
/ %%CLICK_URL%%
クリックURLを返却します。
クリックURLはjavascript:
から始まるため、必ずaタグのhrefに対して設定してください。
例 <a href="%%CLICK_URL%%">
response.title
/ %%TITLE%%
タイトルの文字列を返却します。
response.description
/ %%DESCRIPTION%%
説明文の文字列を返却します。
response.cta
/ %%CTA%%
CTAボタンテキストの文字列を返却します
response.image
/ %%IMAGE%%
バナー画像のURLを返却します。
response.icon
/ %%ICON%%
アイコン画像のURLを返却します
response.rating
/ %%RATING%%
レーティングの数値を返却します。
response.advertiser
/ %%ADVERTISER%%
広告主名を返却します。
response.optoutUrl
/ %%OPTOUT_URL%%
オプトアウトのURLを返却します。 オプトアウトリンクは、明確にオプトアウトリンクとわかるように設置してください。
response.inviewDetectionIdentifier
/ %%INVIEW_DETECTION_IDENTIFIER%%
ネイティブ広告が実際に閲覧される位置に表示されたかを判定(Viewable判定と呼びます)するために必要なクラス名を返却します。
モダンなブラウザでは以下のようにすることで画像の最大サイズを定義することができます。(縦横比の変更はできません。)
※実際にnative_htmlに挿入する際は、ダブルクオーテーション(")のエスケープ、改行の削除が必要です。
<a href="%%CLICK_URL%%">
<div style="display: table-cell; width: 80px; height: 80px; line-height: 0; text-align: center; vertical-align: middle;">
<img src="%%ICON%%" style="max-width: 80px; max-height: 80px;" />
</div>
<div style="display: table-cell; vertical-align: middle;">
[PR]%%TITLE%%<br />%%DESCRIPTION%%
</div>
</a>