How to rotate ads in your website?

How-to-rotate-ads

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.

Auto Faucet Script - Passive Earning

Are you looking to a good earning Auto faucet Script

Faucetspro Auto Faucet Script

Earn money passively with this script.
Click Here
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
ajax-loader
0
Would love your thoughts, please comment.x
()
x