• I use this code for “PPC” advertising:

    <script type="text/javascript">
    ;!( function( w, d ) {
    'use strict';
    var ad = { user: "11111", width: 120, height: 240, id: 'anetwork-' + ~~( Math.random() * 999999  ) },
    h = d.head || d.getElementsByTagName( 'head' )[ 0 ],
    s = location.protocol + '//static-cdn.anetwork.ir/aw/aw.js';
    if ( typeof w.anetworkParams != 'object' )
    w.anetworkParams = {};
    d.write( '<div id="' + ad.id + '" style="display: inline-block"></div>' );
    w.anetworkParams[ ad.id ] = ad;
    d.write( '<script type="text/javascript" src="' + s + '" async></scri' + 'pt>' );
    })( this, document );</script>

    But I have one problem. If I insert code in to the wordpress widget doesn’t work and if I insert in index.php (or page.php , single.php ,…) works!!
    note : error in inspect element >> console (When I insert code in wordpress widget)

    Uncaught SyntaxError: Unexpected token ILLEGAL : "mysite.com/:253
    Failed to load resource: the server responded with a status of 404 (Not Found) : http://mysite.com/'%20+%20s%20+%20'

    line 253 :
    d.write( '</script><script type="text/javascript" src="' + s + '" async>' );
    What is the problem?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The widget code escapes text before output, corrupting your code’s URL construction. Instead of using a widget, you could put the ad directly on your sidebar template (or where ever the widget is).

Viewing 1 replies (of 1 total)
  • The topic ‘Problem to display PPC advertising’ is closed to new replies.