where should i put the ads script ?



  • The ads script below is provided by the ad compay.

    • <script type="text/javascript">
      document.write('<a style="display:none!important" id="tanx-a-mm_81122775_2157835_72285000"></a>');
      tanx_s = document.createElement("script");
      tanx_s.type = "text/javascript";
      tanx_s.charset = "gbk";
      tanx_s.id = "tanx-s-mm_81122775_2157835_72285000";
      tanx_s.async = true;
      tanx_s.src = "http://p.tanx.com/ex?i=mm_81122775_21578359_72285000";
      tanx_h = document.getElementsByTagName("head")[0];
      if(tanx_h)tanx_h.insertBefore(tanx_s,tanx_h.firstChild);
      </script>

    I do not know where i should put it .



  • Itry to put it into the widget Topic.tpl , the topic page does not work .



  • 0_1487852826137_QQ截图20170223202606.png

    The script must be put between <body></body>

    how to put the script between the <body></body> ? which file should i edit ?


  • Admin

    You'll want to edit the header.tpl or footer.tpl file in your theme (if using a custom theme).



  • @julian Iam using the Persona theme .If I put the ads script in the footer.tpl ,the ads does not apear . And I try to put it in the topic.tpl of the Persona theme , then the ads apears ,but the page content disappear . If i refresh the page ,the ads disappears ,and the page content apears . The ads and the page content can not apear at the same time . It seems that they are conflict with each other.


  • Admin

    @zylfanny This is because the ads script you linked uses document.write.

    Try putting it at the end of <head> in the header.tpl



  • @julian thanks。I put it at the end of <head> in the header.tpl , the ads does not apear at the first time , must refresh the page manually ,then the ads can apear . I try many times. I think the best way is to put it in the topic.tpl . Is ther e any other way to let ads and page content appear at the first time ?

    my page with ads : http://www.xdoya.com/topic/269



  • why I click the link in my reply ,the ads and the content can appear at the first tme ,but other topic can not .



  • @zylfanny I have the same problem.


  • Admin

    This is likely due to the ad company not working well with Single Page Applications. You should talk to them about it and see what they say about it...


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.