How JS calls Google AdSense advertising

Source: Internet
Author: User

After consulting and confirming with the Google AdSense team, the tutorial of helping the customer House (www.bkjia.com) allows the webmaster to use js to call Google AdSense ads. The following describes how to call it:

First, write a js file in notepad and paste the code of the google advertisement into it: Find and replace all the "characters and replace them \", search for all the/characters and replace them \/.

Add document. writeln ("Add at the end") at the beginning of each line ");

In this way, the js file for google ads will be ready.

  It is recommended that you use the HTML/JS Conversion Tool to directly convert the GG advertisement code to the JS method:Http://tool.bkjia.com/tool/html_js.asp

Then upload your google ad js file to a folder on your website. In this way, google ads can be used by calling js files.

The following is the js Code of a website (Google_Liehuo.js ):

Reference content is as follows:
Document. writeln ("<script type = \" text \/javascript \ "> <! -");
Document. writeln ("google_ad_client = \" pub -********************\";"); // modify the asterisks in front of your publisher code
Document. writeln ("\/* 728 × 90, created in 09-5-4 *\/");
Document. writeln ("google_ad_slot = \" *************** \ ";"); // modify the asterisks on the front of your actual code.
Document. writeln ("google_ad_width = 728 ;");
Document. writeln ("google_ad_height = 90 ;");
Document. writeln ("\/-> ");
Document. writeln ("<\/script> ");
Document. writeln ("<script type = \" text \/javascript \"");
Document. writeln ("src = \" http: \// pagead2.googlesyndication.com \/pagead \/show_ads.js \ "> ");
Document. writeln ("<\/script> ");

  • 2 pages in total:
  • Previous Page
  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.