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.

Amazon CPM Ads Not Working - Script Gives Errors in Javascript Tester

Discussion in 'JavaScript' started by Amy @ German Pearls, Mar 16, 2016.

  1. #1
    I'm hoping someone can help. I'm not familiar with javascript but have a problem.
    I recently joined Amazon's CPM ad program but the ads aren't displaying on my page. Neither are the passback ads. When I paste the code into a javascript tester it immediately gives an error. Can anyone look at this code and see if there is something wrong with it I can fix? Thank you!

     <script type="text/javascript" language="javascript" src="//c.amazon-adsystem.com/aax2/getads.js"></script>
    <script type="text/javascript" language="javascript">
    //<![CDATA[
    aax_getad_mpb({
      "slot_uuid":"e8837a3d-bbbe-4cf9-89c4-7e81d5a029f2"
    });
    //]]>
    </script> 
    Code (JavaScript):
     
    Amy @ German Pearls, Mar 16, 2016 IP
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #2
    It should work. Your code works in jsfiddle:

    https://jsfiddle.net/7kp17sze/1/

    I don't know what you're using, the blogger or maybe some CMS, but what happens sometimes is the quotation marks ("") turn into &lt; and &gt; upon saving. When they do, the script won't work. When you view the page source, do you see "" or &lt; &gt; ?
     
    qwikad.com, Mar 16, 2016 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    How do you add the code to the site? Do you edit the source files, or are you trying to paste it into an editor-window (like this editor window here in this forum, or the post-window on Wordpress?)
     
    PoPSiCLe, Mar 17, 2016 IP
  4. Amy @ German Pearls

    Amy @ German Pearls Greenhorn

    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #4
    Thanks all. I was able to find a javascript guru like you guys that had the same problem months ago and had resolved it. Turns out there was a wp plugin I was using that was interfering with it. Autoptimize - it's supposed to minimize javascript and css but was messing up the amazon cpm code. I deactivated the plugin and it works perfectly now!

    I'm still confused as to why when I tested the code in some online javascript testers it didn't work. Hm. Maybe I should use jsfiddle from now on. Thanks all!
     
    Amy @ German Pearls, Mar 17, 2016 IP
    PoPSiCLe likes this.
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    Kudos for coming back to your thread and answering your own question - that is how forums should work (but way too often doesn't). This thread is now available and might help others facing the same problem. Great work!
     
    PoPSiCLe, Mar 18, 2016 IP
  6. Amy @ German Pearls

    Amy @ German Pearls Greenhorn

    Messages:
    3
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #6
    Thanks. If others take the time to help the least I can do is come back and let them know how it was fixed. It helps them learn something new too, right? And, I'm hoping someone in the future searching for a resolution to this issue comes along and this post helps them. :)
     
    Amy @ German Pearls, Mar 18, 2016 IP
  7. Chuong Nong

    Chuong Nong Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #7
    Tks, same problem here :)
     
    Chuong Nong, Mar 21, 2016 IP