Noob question--How to place adsense automatically into user generated pages?

Discussion in 'AdSense' started by codexehow, Aug 21, 2011.

  1. #1
    Hello everyone! I just have a quick question that I'm sure at least a few other people are wondering about too. I'm building a site that will receive a lot of user-generated content. On this content I want to place AdSense automatically. I know this can be done because sites like Ehow do it all the time, and there's no way that someone is manually putting the code into each new page. So, can anyone tell me how this is done? The terminology to use when I ask a professional to build such a system?

    Thanks everyone, much appreciated.
     
    codexehow, Aug 21, 2011 IP
  2. incog03

    incog03 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To do this, websites use a template page which has the adsense code in it along with some html and php or whatever. So the page is dynamically populated with the relevant information. Here is an example from my site http://www.myfuturefirst.com.au

    <html>
    <head>
    <title><?php $title ?></title> // for a dynamic title on each page
    Other html header info etc

    </head>
    <body>
    Adsense code
    Adsense code
    Php variables populated with data from the database
    Adsense code
    Footer
    </body>
    </html>

    In actuality my website uses about 3 or so different 'views', I only actually have 1 set of adsense code on any given page on the website but when combined it creates the pages you see there. Relatively simple stuff.
     
    incog03, Sep 2, 2011 IP
  3. JamesColin

    JamesColin Prominent Member

    Messages:
    7,874
    Likes Received:
    164
    Best Answers:
    1
    Trophy Points:
    395
    Digital Goods:
    1
    #3
    it's called adsense revenue sharing if you want to ask for a coder to do it. It's easy, simply replace the adsense publisher id in the adsense code of the page. Of course you should use a template for your site.
     
    JamesColin, Sep 3, 2011 IP
  4. tehseeninter

    tehseeninter Active Member

    Messages:
    629
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #4
    You have different areas or DIV on one page like:

    1. Header
    2. Left side
    3. Right side
    4. Content area
    5. Footer

    for example you want show ads on Right side of your each page then do following:
    
    <?php
    
    echo <<< gAds
    [you adsense code here]
    gAds;
    
    ?>
    
    Code (markup):
    Save above code as php file like imagead.php.

    Now include following code in right side of website to include above ad file:
    
    <?php
    $adpath=$_SERVER['DOCUMENT_ROOT'] . "/[web directory, where file located]/imagead.php";
    include ($adpath);
    ?>
    
    Code (markup):
    Now above code will just paste the ad code, which is in imagead.php.
     
    tehseeninter, Sep 6, 2011 IP