1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Adsense in external js file

Discussion in 'Placement / Reviews / Examples' started by zdvolode, Feb 5, 2006.

  1. #1
    Is it possible to display ads by placing adsense code in external js file and then reference to it from files. Somehow I can't make it posibble without changing the adsense original code and I know it's against their rules.
    And has anyone done this this, please post your expiriences.

    I know it can be done with php but I want to do it this way.
    Also I've done a search through this forum about this topic and found a few threads but couldn't find the right answer.
     
    zdvolode, Feb 5, 2006 IP
  2. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'd just call it with a php or ssi includes.
     
    mdvaldosta, Feb 5, 2006 IP
  3. TommyD

    TommyD Peon

    Messages:
    1,397
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To put the code in an external .js file, I think you have to strip off the script tags. If you do this, this is modifying the code. A TOS violation.

    Follow mdvaldosta's suggestions.

    tom
     
    TommyD, Feb 5, 2006 IP
  4. bschneider5

    bschneider5 Active Member

    Messages:
    1,009
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    88
    #4
    I do it with .php for all my sites.
     
    bschneider5, Feb 5, 2006 IP
  5. zdvolode

    zdvolode Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, I contacted adsense tech support concerning this issue, and they also suggested using php, they also said that if there is a way of placing the code is js file without changing it that they are unaware if it.
     
    zdvolode, Feb 7, 2006 IP
  6. ahkip

    ahkip Prominent Member

    Messages:
    9,205
    Likes Received:
    647
    Best Answers:
    0
    Trophy Points:
    310
    #6
    How come i didn't think about using php....i 've been manually change my code page by page......
     
    ahkip, Feb 7, 2006 IP
  7. TommyD

    TommyD Peon

    Messages:
    1,397
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #7

    If you have a common theme throughout your site, html editors like DreamWeaver have templates, and libraries for replicating design/code changes through your pages.

    hth,

    tom
     
    TommyD, Feb 7, 2006 IP
  8. guitarjunkie66

    guitarjunkie66 Well-Known Member

    Messages:
    52
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #8
    can just ask why you would want to do that?
     
    guitarjunkie66, Feb 9, 2006 IP
  9. ala101

    ala101 Well-Known Member

    Messages:
    863
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #9
    hello all!
    how can i put adsense code in index.php ?
    i want to use "Leaderboard (728 x 90)" with left alignment ..
    what is the code for this plz ?
     
    ala101, Feb 14, 2006 IP
  10. amshaw

    amshaw Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You could possibly use:

    document.write('<adsense code>');

    You wouldn't be modifying the code then... Just writing it into the document at request time :)
     
    amshaw, Feb 2, 2010 IP
  11. Adpubster

    Adpubster Peon

    Messages:
    4,017
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    0
    #11
    SSI is the way to go. Think about it. If you want to change the style of the ad, it's easier to change one file than 5000. Also, heaven forbid that you get banned...then you get accepted by another ad serving outfit. Without SSI you have to go in and manually change all the google adsense to yahoo or wherever. With SSI you change one file for each ad layout and you're done much sooner...and you also know you've changed them all.
     
    Adpubster, Feb 2, 2010 IP