BuySellAds Content Portal

Lazy Loading

Last Updated on April 4, 2017

Lazy Loading doesn’t have to wreak havoc on your advertisements. In fact, ensuring BuySellAds works with your website is a pretty simple. Just follow the steps below to ensure that your impression counts are still working alongside your lazy loading practices.

I use lazy loading on my site. How should I set this up for ad zones for correct impression counts?

You can use the following script so that the ad zone appears for each load. Please keep in mind that this is sample code only, and you will need to edit more and customize for your divs, etc. For this example, we are using the following STEP 2 sample code:



Steps

  1. This is the sample HTML we are using for this example:
  2. And this is the script:
  3. 
     
    
    
  4. Paste the script just before the closing body tag of your site. (At the bottom of your site. This may also work in other places, as long as it is after our STEP 1 code, but we recommend just before the closing body tag.)
  5. In the script for “var n =” you will see “bsap_12345” – this number (12345) should be changed to you zone ID.
  6. In the first append line above, change that div of sample STEP 2 code to your STEP 2 zone div (and delete the [id=”bsap_12345″] part of that code. This part of the code will be added automatically by the script.).
  7. Next, in that same second append line, change the “12345” after “bsap_” to your zone ID. When you change this, be sure to leave the ‘_’ before and after your zone ID.
  8. In the second append line, this represents the name of the div that contains each ad spot. This should be changed to that specific div on your site, whatever you are calling it. (i.e. ad-container, leaderboard-ad, etc.)