Hello, I am currently with an ad company that uses DFP and when their ads don’t show I have my backup google adsense ads come in. In order for these ads to display, I was told I need to add the following code within the <HEAD>:
<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('/158056972/sneakerfiles_300x250_ROS', [300, 250], 'div-gpt-ad-1424368342288-0').addService(googletag.pubads());
googletag.defineSlot('/158056972/sneakerfiles_300x600_ROS', [300, 600], 'div-gpt-ad-1424368342288-1').addService(googletag.pubads());
googletag.defineSlot('/158056972/sneakerfiles_728x90_ROS', [728, 90], 'div-gpt-ad-1424368342288-2').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
Then in the ad spots I wanted I would ad code like this:
<!-- sneakerfiles_ros_160x600 -->
<div id='div-gpt-ad-1405608165645-0' style='width:160px; height:600px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1405608165645-0'); });
</script>
</div>
<!-- sneakerfiles_ros_300x250 -->
<div id='div-gpt-ad-1405608165645-1' style='width:300px; height:250px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1405608165645-1'); });
</script>
</div>
<!-- sneakerfiles_ros_728x90 -->
<div id='div-gpt-ad-1405608165645-2' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1405608165645-2'); });
</script>
</div>
I can’t seem to find the <HEAD> tag. I looked in header, but it’s just one line of code (in Child theme) same for the non-child theme.
Even if I add the top piece of code with one of the bottom in the ad panel under themes, they don’t display. How can I achieve this?
Thanks,
Hi,
Please try to add it like this in the header.php – http://screencast.com/t/XHpJCgkKU3
And then use the other codes in Ads section from Theme Panel for example: http://screencast.com/t/DoGTPa1V4a
Thanks!
Hi,
I’m not sure where you looking for header.php, the file is in the root of the theme: http://screencast.com/t/XgXMd5oBiqs
Thanks!