Several people have voiced concerns about using iframes to display Google Adsense, understandably. This is all news to me. So here is my disclaimer: Use At Your Own Risk!

I think it's the manner in which some people use iframes to display adsense, but not certain. My guess is as good as yours. The way I read it, if you're intentionally doing something underhanded like stuffing keywords, or for example adding words to do something like bring up sexy ads -- which unfortunately typically get more clicks. Since we have no option with Ning until July or after, I don't know any other way to do this, that I can explain here.

I definitely will not take responsibility for anyone getting banned on this. I really cannot. If you have an Adsense account, you need to do your own research.

Network Creators often ask: "How do I put my Google Ads in the header?"

How To Add Google Ads or Other Content to Your Header:
Summary - Prepare your content and add to an external HTML. Call into your Network Header via the Analytics Box, using an iframe and JavaScript. NOTE: You can add other content in your HTML, not just Google Ad Code.

  1. Create your HTML.
  2. For example, if you are adding Google Ads, copy/paste the code into a new HTML file. I usually wrap a DIV around my code, and I add a BODY tag with a white background. Here is the example of my Google Ad code (728 by 15) text links. This example is the entire HTML file.

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Ning Directory - Directory of Ning Networks</title>

<body bgcolor=white><div align=center>
<script type="text/javascript"><!--
google_ad_client = "pub-3491017725492xxx";
/* 728x15, created 7/30/08 */
google_ad_slot = "9036396336";
google_ad_width = 728;
google_ad_height = 15;
<script type="text/javascript"


  1. How to center content in your HTML - Within your external HTML, add a DIV with align=center, around your header content. See example HTML file above.
  2. Background color - the best way to set iframe background color: add the body tag to your external HTML, like in example above. This is an important step.
  3. After you have completed your HTML file, upload to your file server. If you don't have a file server, upload to your Ning Network via a Blog (be sure to click on document upload icon).
  4. When you upload to your blog, copy the HTML path. You must know the HTML path/URL.
  5. Now it's time to prepare your code for the Analytics box.
  6. Focusing on the example code below, replace the src="your.html" with your HTML file path.
  7. Adjust the iframe width and height to fit your HTML content area. For example, my Google Ad space is 728 by 15. For my Analytics Box code I will use width=735 and height=20. I want to allow for a few extra pixels, for proper spacing.
  8. After you make your edits, add the example code below, to your Analytics box - Manage/Analytics, and SAVE.
  9. For this example, we are adding the iframe after the Menu Navigation Bar. If you want to add above the menu, just change "after" to "before".
<script type="text/javascript">
x$("#xg_navigation").after("<div id='custom_ads'></div>");
var ad_html = '<iframe frameborder="0" scrolling="no" allowtransparency="true" marginheight="0" marginwidth="0" src="your.html" width="735px" height="20px"></iframe>';

Tags: ad in header, add ad to header, add content to header, customize header, google ads in header, header, header ad, header content, header like ning

Views: 1558

Reply to This

Replies to This Discussion

Hi Stefaan,
Sure. You can place below Ningbar, or above the masthead.
Here's the topbar version, just modify the first part of this line:
x$("#xg_navigation").after("<div id='custom_ads'></div>");
And above masthead:

Hey Jen,

Almost there...

Would it be possible to move it some pixels down also? Or should I try with adding 2 rows in the linked html. The first row could specify the pixels I would like to go down.
Got it figured out:

style="padding-top:100px"; added to the iframe ;)
Good deal, and good job! ;-)


What's Up With Ning 3.0?

Click here to share your thoughts on what features we should develop next! - Survey will close Friday, 4/25

Projects that the Ning 3.0 Team is currently working on: 

Articles - a new way of organizing longer content pieces. Released 4/16.

Activity Feed Updates - options for more content in the activity feed.

Forum Notifications - ability for members to opt into receiving notifications of new discussions in forums. Released 4/9. 

APIs - The ability to create new members and content programatically.

For more information on what's next, visit the Product Roadmap

Latest Activity

NC for Hire
JFarrow replied to John Bizley's discussion 'Has anyone else considered using a tab container for help files ?'
"this tip is infinitely useful to NCs John .. I've been doing something similar, but instead of…"
1 hour ago
soaringeagle replied to Riccardo Rossini's discussion 'Please Ning staff'
"category nav seems fixed  but custom page module still screwy but..great job on a very speredy…"
1 hour ago
Jelena replied to Riccardo Rossini's discussion 'Please Ning staff'
"Same as SE. That would be a problem with the Trademark name.."
4 hours ago
soaringeagle replied to Riccardo Rossini's discussion 'Please Ning staff'
"same on all sites its a bug"
4 hours ago
Jelena replied to Riccardo Rossini's discussion 'Please Ning staff'
"Hi Riccardo I see no navegation on your network"
4 hours ago
Aaron replied to Rainer Glaap's discussion 'Heartbleed, MITM - Security Issues'
"Thanks for bringing this up! As Rainer mentioned, wasn't vulnerable to the Heartbleed…"
4 hours ago
Khatlen Guse replied to Stig Karlsen's discussion 'Problems with Facebook activity feed'
"Hi Stig! My feed its ok now! :) I hope that your is ok too."
4 hours ago
soaringeagle replied to Riccardo Rossini's discussion 'Please Ning staff'
"id use that but to be safe make sure theres no copywrite on the pentaprism and if there is it…"
5 hours ago

© 2014   Created by Ning.

Badges  |  Report an Issue  |  Terms of Service