How to Put Your AdSense Code in Facebook

By John Mitchell

You can now post your AdSense code on your Facebook page or app. Facebook Developers can use the iFrame tool to build apps that run in HTML, JavaScript or CSS. To get your AdSense ads displaying on a page tab or app, you will need to insert the Javascript code snippet into a new iFrame Facebook app. Once set up, you can begin advertising via Google's third-party ad platform, reaching Facebook's large user database.

Things You'll Need

  • AdSense account
  • Facebook Developer account

AdSense Code Set Up

Step 1

Go to adsense.google.com and log in to your Google AdSense account.

Step 2

Generate your AdSense code in your account by clicking the "New Ad Unit" button from the "My Ads" tab.

Step 3

Customize the appearance and settings for your ad display. Click the "Save and Get Code" button when finished.

Step 4

Select the code snippet and copy it into the computer's memory buffer.

Step 5

Open an HTML document in a text editor and paste the Javascript code at a location you want to show the advertisements.

Step 6

Upload the file to your Web hosting server. Copy or record the full Web address to the uploaded HTML file. You will use this hyperlink later in the Facebook app as the "Canvas URL."

Facebook App Setup

Step 1

Go to developers.facebook.com, log in to your account and then click the "Set Up New App" option in the top right corner.

Step 2

Type a Facebook application name and accept Facebook's terms and conditions.

Step 3

Confirm your Facebook Developer account via credit card or mobile phone.

Step 4

Fill out the required information necessary to create the app and click the "Save Changes" button when finished.

Step 5

Click on the "Facebook Integration" tab and add the required details for "Canvas Page," "Canvas URL" and "Canvas Type." When finished, click "Save Changes" button. The "Canvas URL" is the Web address that points directly to the file you uploaded to your hosting server.

Step 6

Click on the "View App Profile Page" option located on the left side of the screen. On the next screen, click the "Add to my page" link on the left column. A pop-up dialog box will appear.

Step 7

Choose which page or pages you would like to add the Facebook app to and then click the "Close" button. Your AdSense ads should now display as a tab on the Facebook page you selected.

Tips & Warnings

  • For Google AdSense to function properly and display ads, you must have actual content, such as text, on the same page in which you insert the Javascript code snippet. If you do not, you are in violation of the Google AdSense terms of use.
  • Displaying third-party advertising platform ads on the Facebook website may be against the company's terms of service. Please check the terms of use agreement for Facebook Pages and Facebook Apps before implementing this method.