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)