Archive for the ‘Google Adsens’ Category

แปลงโค้ดแทรกโฆษณา Adsense ลงในบล็อก Blogger

Thursday, January 12th, 2017 |

แปลงโค้ดใส่โฆษณา Adsense ลงในบล็อก Blogger

เคยเจอกันไหมครับ เวลาที่เราจะแทรกโค้ดโฆษณาของ Google Adsense หรือแม้แต่โค้ด javascript ต่างๆ ลงใน XML template ของ Blogger พอบันทึกเปลี่ยนแปลงแก้ไขแม่แบบแล้วมันจะขึ้น Error ดังข้อความตัวอย่าง ดังนี้

“Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The processing instruction target matching “[xX][mM][lL]” is not allowed.”

หรือ

“Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The content of elements must consist of well-formed character data or markup.“

แล้วเราจะมีวิธีการอย่างไรถึงจะแทรกโค้ดโฆษณาของ Google Adsense หรือโค้ด javascript ลงใน XML template หรือ XML แม่แบบของบล็อก Blogger ของเรา มาดูกันครับ

วิธีแปลงโค้ดใส่โฆษณา Adsense ลงในบล็อก Blogger

1. ไปที่เว็บ Blogger Ad Code Converter จากนั้นวางโค้ด Google Adsense ลงไปในช่อง Paste Ad Code to Convert Here:
สมมติว่า โค้ด Google Adsense เป็นดังนี้

<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<!– สร้างเมื่อ 11/08/10- –>
<ins class=”adsbygoogle”
     style=”display:inline-block;width:300px;height:250px”
     data-ad-client=”ca-pub-4569076549340596″
     data-ad-slot=”6879584328″></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

เราก็วางโค้ดลงในช่อง ตัวอย่างดังรูป

2. จากนั้นกดปุ่ม Convert Ad Code จะได้โค้ดที่แปลงแล้ว ให้กดปุ่ม Highlight All  แล้วคัดลอกไว้ ซึ่งตัวอย่างโค้ดที่แปลงแล้วเป็น ดังนี้

&lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
&lt;!– &agrave;&cedil;&ordf;&agrave;&cedil;&pound;&agrave;&sup1;�&agrave;&cedil;&sup2;&agrave;&cedil;�&agrave;&sup1;�&agrave;&cedil;&iexcl;&agrave;&cedil;&middot;&agrave;&sup1;�&agrave;&cedil;&shy; 11/08/10- –&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:inline-block;width:300px;height:250px&quot;
     data-ad-client=&quot;ca-pub-4569076549340596&quot;
     data-ad-slot=&quot;6879584328&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

 ตัวอย่างดังรูป

3. จากนั้นให้ไปที่หน้า แก้ไขHTML ซึ่งอยู่ในเมนู แม่แบบ > แก้ไขHTML แล้วหาจุดที่เราจะแทรกโค้ด Google Adsense ลงไปแล้วเลือกวางโค้ดนั้นๆ ในตำแหน่งที่เราต้องการได้เลยครับ

4. จากนั้นกดปุ่ม บันทึกเทมเพลต แล้วไปที่หน้าบล็อกหรือหน้าบทความ เพื่อดูผลลัพธ์ได้เลย หรือเพื่อให้แน่ใจว่าจะไม่มีอะไรผิดพลาด ให้กดปุ่ม ดูตัวอย่างเทมเพลต ก่อนก็ได้ ถ้าแสดงผลเป็นที่พอใจค่อยกดปุ่มบันทึกเทมเพลตก็ได้ครับ

ลองนำวิธีแปลงโค้ดใส่โฆษณา Adsense ลงในบล็อก Blogger ไปปรับใช้กันดูนะครับ

หมายเหตุ: โค้ดแที่แปลงแล้วนี้ ผิดกฏของ AdSense program policies. ด้วยนะครับ เพราะไม่มีการปรับแก้อะไร เพียงแต่แปลงตัวเปิด-ปิดแท๊ก หรือ XHTML entities เพื่อให้สามารถใช้งานใน XML template ของ Blogger ได้เท่านั้นเอง

About Me

เว็บ ilovebrowser.com(i♥b) ก่อตั้งขึ้นมาเพื่อเป็นแหล่งข้อมูล แหล่งเรียนรู้ วิธีการใช้งานเว็บเบราว์เซอร์ วิธีแก้ไขปัญหาเว็บเบราว์เซอร์ แนะนำทิป ทริก เทคนิคต่างๆ ที่เกี่ยวกับเว็บเบราว์เซอร์ ไม่ว่าจะเป็นเว็บเบราว์เซอร์ Internet Explorer,Firefox,Chrome,Opera,Safari,Maxthon และเว็บเบราว์เซอร์อื่นๆ More

Want to subscribe?

Subscribe in a reader