「Mobile NativeAd」修訂間的差異
跳至導覽
跳至搜尋
imported>Wikiuser |
imported>Wikiuser (→範例程式) |
||
行 22: | 行 22: | ||
nadParas.LONGSUBJECT //長標題 | nadParas.LONGSUBJECT //長標題 | ||
nadParas.ICONSQUARE //Icon圖片 | nadParas.ICONSQUARE //Icon圖片 | ||
nadParas .IMAGE640X960 //640*960圖片 | nadParas.IMAGE640X960 //640*960圖片 | ||
nadParas .IMAGE960X640 //960*640圖片 | nadParas.IMAGE960X640 //960*640圖片 | ||
nadParas .IMAGE1280X720 //1280*720圖片 | nadParas.IMAGE1280X720 //1280*720圖片 | ||
nadParas .IMAGE720X1280 //720*1280圖片 | nadParas.IMAGE720X1280 //720*1280圖片 | ||
nadParas .IMAGE1200X627 //1200*627圖片 | nadParas.IMAGE1200X627 //1200*627圖片 | ||
nadParas .ICONRECTANGLE //長方形Icon圖片 | nadParas.ICONRECTANGLE //長方形Icon圖片 | ||
nadParas .VIDEO //影片 | nadParas.VIDEO //影片 | ||
nadParas .BODY //內文 | nadParas.BODY //內文 | ||
nadParas .nurl //點擊URL | nadParas.nurl //點擊URL | ||
}else{ | }else{ | ||
//TO DO | //TO DO | ||
行 38: | 行 38: | ||
</head> | </head> | ||
</html> | </html> | ||
== Mobile Native AD SDK 參數說明== | == Mobile Native AD SDK 參數說明== |
於 2016年9月6日 (二) 09:02 的修訂
使用方式說明
1. 請於HTML的head tag中加入Mobile SDK的JavaScript
2. 請於window.onload中呼叫原生廣告,在請求時,請帶入正確的版位ID及Callback function,供SDK回傳原生廣告的素材
3. 於Callback function中取得原生廣告素材後,可使用CSS自行調整圖片及文字的顯示
範例程式
<html> <head> <script type="text/javascript" src="http://adc.tamedia.com.tw/rmadp/static/js/gm-sdk3-mobile.js"></script> <script type="text/javascript" language="javascript"> window.onload = function(){ getNativeAdParas("testslot123456", nativeAdCallback); }; function nativeAdCallback(nadParas){ // 表示目前有廣告 if(nadParas == "00"){ nadParas.SHORTSUBJECT //短標題 nadParas.LONGSUBJECT //長標題 nadParas.ICONSQUARE //Icon圖片 nadParas.IMAGE640X960 //640*960圖片 nadParas.IMAGE960X640 //960*640圖片 nadParas.IMAGE1280X720 //1280*720圖片 nadParas.IMAGE720X1280 //720*1280圖片 nadParas.IMAGE1200X627 //1200*627圖片 nadParas.ICONRECTANGLE //長方形Icon圖片 nadParas.VIDEO //影片 nadParas.BODY //內文 nadParas.nurl //點擊URL }else{ //TO DO } }; </script> </head> </html>
Mobile Native AD SDK 參數說明
參數名稱 | 參數型別 | 參數值 | 說明 |
slotSubId | String | 版位ID,由TAM提供 | |
nativeAdCallback | Function | Callback function | 為Callback Funciton供SDK回傳值使用 |
Callback Function回傳值
Callback Function回傳值 | 說明 |
00 | 請求廣告成功 |
10 | NAD的Callback function不為function型態 |
20 | 請求廣告成功,但無廣告 |
30 | 請求失敗,伺服器端回應錯誤 |
40 | 請求錯誤 |
nadParas.SHORTSUBJECT | 原生廣告的短標題 |
nadParas.LONGSUBJECT | 原生廣告的長標題 |
nadParas.ICONSQUARE | 原生廣告的Icon圖片 |
nadParas.IMAGE640X960 | 原生廣告的640*960圖片 |
nadParas.IMAGE960X640 | 原生廣告的960*640圖片 |
nadParas.IMAGE1280X720 | 原生廣告的1280*720圖片 |
nadParas.IMAGE720X1280 | 原生廣告的720*1280圖片 |
nadParas.IMAGE1200X627 | 原生廣告的1200*627圖片 |
nadParas.ICONRECTANGLE | 原生廣告的長方形Icon圖片 |
nadParas.VIDEO | 原生廣告的影片 |
nadParas.BODY | 原生廣告的內文 |
nadParas.nurl | 原生廣告的點擊URL |