rotate-ads

How to rotate ads in your website?

Earn with Faucet-website Faucet Owner Assets Tips and Tricks

Everyone wants to generate huge income from their website by ads. You know one of the methods is to rotate ads. If you have your auto-faucets then rotation of ads is very recommended.

So if you don’t know how to rotate ads then I will help you in this post. With help of below PHP code snippet, you can do it easily.

Step -1:

Just create a new file named ads-rotation.php and paste the below code there like

       //Paste the below code in ads-rotation.php inside php tag.
      // Like <?php BELOW ADS CODE COMES HERE ?>
      //728x90
      $leaderboard_ads[0] = 'Your 728x90 AD Code - 1';
      $leaderboard_ads[1] = 'Your 728x90 AD Code - 2';
      $leaderboard_ads[2] = 'Your 728x90 AD Code - 3';
      $leaderboard_ads[3] = 'Your 728x90 AD Code - 4';
      $leaderboard_ads[4] = 'Your 728x90 AD Code - 5';
      $leaderboard_ads[5] = 'Your 728x90 AD Code - 6';


      //160x600
      $sidebar_ads[0] = 'Your 160x600 AD Code - 1';
      $sidebar_ads[1] = 'Your 160x600 AD Code - 2';
      $sidebar_ads[2] = 'Your 160x600 AD Code - 3';
      $sidebar_ads[3] = 'Your 160x600 AD Code - 4';
      $sidebar_ads[4] = 'Your 160x600 AD Code - 5';
      $sidebar_ads[5] = 'Your 160x600 AD Code - 6';

      //300x250 
      $square[0] = 'Your 300x250 AD Code - 1';
      $square[1] = 'Your 300x250 AD Code - 2';
      $square[2] = 'Your 300x250 AD Code - 3';
      $square[3] = 'Your 300x250 AD Code - 4';
      $square[4] = 'Your 300x250 AD Code - 5';
            

      //Popads code is used in bottom.php file so it will appear in every page 
      $popads[0] = 'Your Popup AD Code - 1';
      $popads[1] = 'Your Popup AD Code - 2';



      //Function to rotate ads
      function AdsRandom($ads_array)
      {
            $ads = $ads_array;
            return $ads[rand(0, count($ads)-1)];
      }

Step – 2:

Import above ads code file in you other php files where you want to show the random ads code. Like below

      //Paste the below code in ads-rotation.php inside php tag.
      // Like <?php BELOW ADS CODE COMES HERE ?>
      include_once $_SERVER['DOCUMENT_ROOT'] . '/ads-rotation.php';

Step – 3:

Now you can able to call any type of random ads anywhere. Like below-

      //Paste the below code in ads-rotation.php inside php tag.
      // Like <?php BELOW ADS CODE COMES HERE ?>
      echo AdsRandom($leaderboard_ads); // For 728x90
      echo AdsRandom($sidebar_ads); // For 160x600
      echo AdsRandom($square); // For 300x250
      echo AdsRandom($popads); // For POPUP ads. Place this code in Every file just before </body> tag

Congratulations!!!, You learnt how to rotate ads.

Tagged

Review Overview

Summary
4.5

Leave a Reply

Your email address will not be published.