ลองเอาโค๊ดดัดแปลงนี้ไปใช้ดูจิ
แบบ A1 เอาโค๊ดใส่ แล้ว include ไฟล์ adsense
แบบ B2 include file adsense แล้ว เอา โค๊ดใส่ใน adsense ข้างนอก (น่าจะดีที่สุด)
แบบ C3 แบบ เอาทั้งหมดใส่ไว้ในหน้าเว็บทั้งหมดเลย (ขยะจะเยอะหน่อย)
แต่ไม่แน่ใจ ถ้าใครใช้ adbloger ที่ใช้ล็อก adsense เวลาโดน คลิก bom อะ
ว่ามันจะใช้งานได้หรือเปล่านะ
แบบ B2 ผมว่าดีที่สุด เพราะเขีนนโค๊ดใน html น้อย แล้วแยก ตัว adsese ออกมาข้างนอกเลย
แบบ A1
เอาโค๊ดใส่ไว้ในไฟล์ index หรือ ไฟล์ webpage เลย
index.php
<?php
/* Use this to start a session only if the UA is *not* at search engine
to avoid duplicate content issues with url propagation of SID's */
$searchengines=array("Google", "Fast", "Slurp", "Ink", "ia_archiver", "Atomz", "Scooter");
$is_search_engine=0;
foreach($searchengines as $key => $val) {
if(strstr("$HTTP_USER_AGENT", $val)) {
$is_search_engine++;
}
}
if($is_search_engine==0) { // not a search engine
/* You can put anything in here that needs to be
hidden from searchengines */
include ("adsense1.html");
} else { // Is a search engine
/* Put anything you want only for searchengines in here */
include ("blank.html");
}
?>
adsense1.html
<script type="text/javascript"><!--
google_ad_client = "ca-test";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
แบบ B2
adsense.php
<?php
/* Use this to start a session only if the UA is *not* at search engine
to avoid duplicate content issues with url propagation of SID's */
$searchengines=array("Google", "Fast", "Slurp", "Ink", "ia_archiver", "Atomz", "Scooter");
$is_search_engine=0;
foreach($searchengines as $key => $val) {
if(strstr("$HTTP_USER_AGENT", $val)) {
$is_search_engine++;
}
}
if($is_search_engine==0) { // not a search engine
/* You can put anything in here that needs to be
hidden from searchengines */
print <<<END
<script type="text/javascript"><!--
google_ad_client = "ca-test";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
END;
} else { // Is a search engine
/* Put anything you want only for searchengines in here */
print <<<EOF
<!---- blank / noting ---->
EOF;
}
?>