how to add dfp code ?

Posted in: Newsmag
Post count: 54

Hi,
we use dfp for our ads and we need to add code in header like

<script type=’text/javascript’>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement(‘script’);
gads.async = true;
gads.type = ‘text/javascript’;
var useSSL = ‘https:’ == document.location.protocol;
gads.src = (useSSL ? ‘https:’ : ‘http:’) +
‘//www.googletagservices.com/tag/js/gpt.js’;
var node = document.getElementsByTagName(‘script’)[0];
node.parentNode.insertBefore(gads, node);
})();
</script>

<script type=’text/javascript’>
googletag.cmd.push(function() {
googletag.defineSlot(‘/2705106/MA_728x90_BAS_DE_PAGE’, [728, 90], ‘div-gpt-ad-1351019229538-0’).addService(googletag.pubads());
googletag.defineSlot(‘/2705106/MA_ros_160x600’, [160, 600], ‘div-gpt-ad-1351019229538-1’).addService(googletag.pubads());
googletag.defineSlot(‘/2705106/MA_ros_160x600_BAS_DE_PAGE’, [160, 600], ‘div-gpt-ad-1351019229538-2’).addService(googletag.pubads());
googletag.defineSlot(‘/2705106/MA_ros_300x250’, [300, 250], ‘div-gpt-ad-1351019229538-3’).addService(googletag.pubads());
googletag.defineSlot(‘/2705106/MA_ros_300x250_BAS_DE_PAGE’, [300, 250], ‘div-gpt-ad-1351019229538-4′).addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

where can we add it ? I find where add code like

<!– Ma_728x90_PQ –>
<div id=’div-gpt-ad-1379702677181-0′ style=’width:728px; height:90px;’>
<script type=’text/javascript’>
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1379702677181-0’); });
</script>

but not for the header

thanks

Post count: 6600

Hi,

You need to add the script in theme’s header file before the closing head tag: http://screencast.com/t/H2kT8kFIE

Thanks for the message!

Post count: 9

Hi I have a problem since I bought the theme puedover not ads in my header and sidebar code is as follows:
<async script src = “// pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”> </ script>
<! – Header ->
<ins class = “adsbygoogle”
      style = “display: inline-block; width: 728px; height: 90px”
      data-ad-client = “client”
      data-ad-slot = “6890445916”> </ ins>
<script>
(adsbygoogle = window.adsbygoogle || []) push ({}).;
</ script>
where this error

Post count: 6600

Hi,

Andrei replied you on your other post on this: https://forum.tagdiv.com/topic/no-adsense-ads-are-displayed-throughout-the-site/#post-68625 give it some time and google should start deliver them soon.

Thanks

Post count: 54

i add the code where you tell me and i add after in admin the code from dfp in header ads

<!– Ma_728x90_PQ –>
<div id=’div-gpt-ad-1379702677181-0′ style=’width:728px; height:90px;’>
<script type=’text/javascript’>
googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1379702677181-0’); });
</script>

But the header come black and we lost the logo , you can look here

http://v2.planete.qc.ca/

Post count: 54

ok i have remove dfp code and add her javascript code is working now, but i think i dont use the good <div class because now ads was on top not center ? The logo was not in same place then ads

Post count: 9

I so in the head but not the ads displayed if sidebar

Contenido Interesante

  • This reply was modified 10 years by marmacan.
Post count: 22421

Hi marmacan,

This could happen due to various reasons, please go trough the adsense troubleshooter pasted below and contact your ad provider if you still can’t manage to make them work: https://support.google.com/adsense/answer/1208336?hl=en

You can also test your ad code using a WordPress text widget to place the ad into your page or sidebar, if your ad code works/was approved this widget should show you ads: http://screencast.com/t/Cv00hEmZhIvhttp://screencast.com/t/Yp3N6YnaHiqg


@yopyop22
Theme’s ads spots were not designed to work with dfp ad codes so issues might appear. You cloud try use a plugin to render the ad codes then place your ads on page/posts using shortcodes.

Thanks for the message!

Post count: 9

Hello, I read everything and seems to be correct. advertising alone sidebar header appears never does.
http://min.us/i/mJrq7N69NAPY

Post count: 6600

Hi marmacan,

Please send us your site’s admin panel login details via email at contact@tagdiv.com including a link to this conversation, so we can have a closer look at this and check how have you setup your ads.

Thanks

Post count: 9

hi good day just to send mail to access my site http://www.contenidointeresante.com. I hope you can fix it thanks

Post count: 9

I have not been solved by deleting the entire site and its database, lost everything but I will escreibir entries as other pictures, sorry no other way

Post count: 208

I posted in other thread and it takes up to a week to review site as new account even if you already have ads added. If already approved then it takes two to three days for your newly placed ads via theme to start showing again where you added them. You also have to follow Googles documentation or you will get banned. They are really picky on ads on a site and no smart sidebar used with ads on the sidebar, its considered floating widget and is against their TOS.

Post count: 9

In advertisements brand Newsmag and also like the Russian language is always touted , it is very rare because I’m Latin and many people in Europe example Spain has told me that look the same and do not advertise your region , ads are provided by Adsense, there any way to change the geolocation to the theme ?

Viewing 14 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic.