Title: Get Ads using javascript
Last modified: March 19, 2019

---

# Get Ads using javascript

 *  Resolved [Lisa Jong](https://wordpress.org/support/users/lisajong/)
 * (@lisajong)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/)
 * Hi Thomas,
 * I am having this tricky situation here and if you can provide any idea of how
   to implement this I would greatly appreciate your help.
    So Advanced Ads works
   perfectly on some pages of our website, like those sticker ads on [this page](http://gcla.wpengine.com/instruccion/).
   However, for some pages the content is filled by javascript from an external 
   feed, like [this page](http://gcla.wpengine.com/noticias/?category=golf-talk-central).
   Is there a recommended way of how to get Ads and insert them as part of the content
   using javascript? If you can give me any idea, really, any idea would be great.
 * Thank you in advance!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11329582)
 * Hi Lisa,
 * thanks for reaching out.
 * I am not seeing JavaScript output on the second page. Did you remove it?
    Do 
   you experience issues when having ads in the content that is loaded on your site
   using AJAX (the one appearing when “Load more” is finished)?
 * Thanks,
    Thomas
 *  Thread Starter [Lisa Jong](https://wordpress.org/support/users/lisajong/)
 * (@lisajong)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11329662)
 * Hi Thomas,
 * Thank you for replying, wow this is fast. On [this page](http://gcla.wpengine.com/noticias/?category=golf-talk-central)
   all the news blocks are fed from a json by javascript. For every 5 news, the 
   sixth block would be an Ad (it’s a grey box for now). I am trying to find a way
   to replace these grey boxes with Ads I set up in Advanced Ads, using javascript.
 * Thanks,
    Lisa
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11329674)
 * Hi Lisa,
 * how is this sixth `small-ad` placeholder added right now? If you can influence
   this then there might be a way for Advanced Ads to place an ad there. I don’t
   think we can place something there right now after the content is loaded via 
   JavaScript, so best is to hook in before that happens.
 * Thomas
 *  Thread Starter [Lisa Jong](https://wordpress.org/support/users/lisajong/)
 * (@lisajong)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11333291)
 * Hi Thomas,
 * The javascript was written by us to place those news blocks. Would you please
   give me a rough idea of how to “hook in” the ads in our javascript code? It’s
   OK if we have to make some changes in php code too. Thank you!
 * Lisa
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11333310)
 * Hi Lisa,
 * thanks for your reply.
 * If I understand correctly then your JavaScript code is generated using PHP, right?
   
   You can load the content of an ad, a group or placement using the theme functions
   listed on [https://wpadvancedads.com/codex/theme-functions/](https://wpadvancedads.com/codex/theme-functions/).
 * Does that help?
 * Thomas
 *  Thread Starter [Lisa Jong](https://wordpress.org/support/users/lisajong/)
 * (@lisajong)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11333350)
 * Hi Thomas,
 * Thank you. Unfortunately our javascript code isn’t generated by PHP. It’s written
   and placed to a specific page using another plugin. So this part is a pure frontend
   development. But you are right! If I move the generation of the javascript to
   backend I can use all those functions provided then. I believe this is the route
   we should go. Thank you again for your help!
 * Lisa
 *  Plugin Author [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * (@webzunft)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11333378)
 * Perfect. Let me know if you need anything.
 * Thomas

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Get Ads using javascript’ is closed to new replies.

 * ![](https://ps.w.org/advanced-ads/assets/icon-256x256.gif?rev=2773443)
 * [Advanced Ads – Ad Manager & AdSense](https://wordpress.org/plugins/advanced-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-ads/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Thomas Maier](https://wordpress.org/support/users/webzunft/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/get-ads-using-javascript/#post-11333378)
 * Status: resolved