Thread:Project:Support desk/add google ads embedded in page content

I would like to add google ads after the first paragraph on every page on my wiki. I have a code that checks if a tag is there, if it isn't then the tag is added and this tag calls the code for the google ads. However, the rest of the text on the page is not showing after the ads. This is my code: (based on the AdsWhereever extension) setHook( 'ads', 'AdsRender' ); return true;} function AdsRender($input, $args ) { $input =""; $url = array; global $wgOut;

$ad['goo1'] = '  google_ad_client = "xxx"; google_ad_width = 728; google_ad_height = 90;  ';	$media = $args['media']; return $ad[$media]; }

// check if content has tag function CheckHasTag($editPage){global $wgOut; $wgOut->addScript('	var editTextboxText = document.getElementById("wpTextbox1").value;					var searchFor = "goo1";					var searchResult = editTextboxText.search(searchFor);					if(searchResult == -1){					var a = editTextboxText;					var b = "\n \n";					var findP = "\n"; 					var p = editTextboxText.search(findP);					var position = p;		document.getElementById("wpTextbox1").value = a.substr(0, position) + b + a.substr(position); } ');return true;}