Title: Adding javascript for Lazy load Ads
Last modified: August 30, 2016

---

# Adding javascript for Lazy load Ads

 *  [wp169](https://wordpress.org/support/users/wp169/)
 * (@wp169)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/adding-javascript-for-lazy-ads/)
 * Hello,
 * I have few ads that are inline and I want to load them as lazy load. I found 
   a solution available on ‘[https://github.com/madgex/lazy-ads&#8217](https://github.com/madgex/lazy-ads&#8217);.
   I have to first load this javascript `<script src="../path_to/lazyad-loader.min.
   js" async></script>` and then use with ad tags.
 * I will keep the file in child theme include folder. My question is where can 
   I copy this code `<script src="../path_to/lazyad-loader.min.js" async></script
   >` such that script is available in all the site pages?
 * Please advise.
    If you know of a better way to lazy load ads in the theme, please
   let me know.
 * Thanks for your help!

Viewing 1 replies (of 1 total)

 *  [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * (@bdbrown)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/adding-javascript-for-lazy-ads/#post-6590992)
 * Hi there. Based on the [recommendation in the WP Codex](https://codex.wordpress.org/Using_Javascript),
   you would put it in header.php, before the wp_head() call:
 *     ```
       <head>
       	<meta charset="<?php bloginfo('charset'); ?>">
       	<meta name="viewport" content="width=device-width, initial-scale=1.0">
       	<link rel="profile" href="http://gmpg.org/xfn/11">
       	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
       	       <------ add your script code here
       	<?php wp_head(); ?>
       </head>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Adding javascript for Lazy load Ads’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/hueman/3.7.27/screenshot.png)
 * Hueman
 * [Support Threads](https://wordpress.org/support/theme/hueman/)
 * [Active Topics](https://wordpress.org/support/theme/hueman/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/hueman/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/hueman/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/adding-javascript-for-lazy-ads/#post-6590992)
 * Status: not resolved