Adding Google DFP Code to the <head> section
Board index / PHP Melody - Video CMS
7 posts • Page 1 of 1
Hi Guys
I'm trying to add some code to the <head> section to enable Google DFP, but when I insert it in header.tpl it results in a blank screen.
I've tried adding it just before </head> and other areas further up but I get the same result.
Any idea what I'm doing wrong?
Here's the code:
<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('/4761035/cltv-ros-mr-right', [300, 250], 'div-gpt-ad-1401171934427-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
I'm trying to add some code to the <head> section to enable Google DFP, but when I insert it in header.tpl it results in a blank screen.
I've tried adding it just before </head> and other areas further up but I get the same result.
Any idea what I'm doing wrong?
Here's the code:
<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('/4761035/cltv-ros-mr-right', [300, 250], 'div-gpt-ad-1401171934427-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
- westcoastradio
- Non-verified
- Posts: 4
- Joined: Jan 09, 2014 12 am
- Reputation points: 0
put it between {literal} and {/literal}
PHP Melody Plugins developer
PHP Melody plugins + themes for 1.6 and 1.7-2.7 | Subscribe to news of my work | Follow me on Facebook
PHP Melody plugins + themes for 1.6 and 1.7-2.7 | Subscribe to news of my work | Follow me on Facebook
-
Trace - Verified Customer
- Posts: 2543
- Joined: Aug 16, 2010 3 pm
- Location: The Netherlands
- Reputation points: 1329
Worked!
Thanks Trace...
Thanks Trace...
- westcoastradio
- Non-verified
- Posts: 4
- Joined: Jan 09, 2014 12 am
- Reputation points: 0
I've looked everywhere for the {literal} and {/literal} and couldn't find them.
If possible can someone tell me where to find them?
I'm having the same issue.
Thanks
If possible can someone tell me where to find them?
I'm having the same issue.
Thanks
- yahyaelsherif
- Non-verified
- Posts: 3
- Joined: Jun 29, 2015 8 pm
- Reputation points: 0
They arent there, you have to write them around your code to make sure it works.
PHP Melody Plugins developer
PHP Melody plugins + themes for 1.6 and 1.7-2.7 | Subscribe to news of my work | Follow me on Facebook
PHP Melody plugins + themes for 1.6 and 1.7-2.7 | Subscribe to news of my work | Follow me on Facebook
-
Trace - Verified Customer
- Posts: 2543
- Joined: Aug 16, 2010 3 pm
- Location: The Netherlands
- Reputation points: 1329
Trace wrote:They arent there, you have to write them around your code to make sure it works.
Thank you Trace but it still doesn't work.
http://www.sevendynamicserver.com/video ... =ec8b9c671
http://www.sevendynamicserver.com/videos/
=(
- yahyaelsherif
- Non-verified
- Posts: 3
- Joined: Jun 29, 2015 8 pm
- Reputation points: 0
{literal}
<script type='text/javascript'>
(function() {
var useSSL = 'https:' == document.location.protocol;
var src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
})();
</script>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/62250220/1', [728, 90], 'div-gpt-ad-1435616654270-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.pubads().enableSyncRendering();
googletag.enableServices();
});
</script>
{/literal}
- yahyaelsherif
- Non-verified
- Posts: 3
- Joined: Jun 29, 2015 8 pm
- Reputation points: 0
7 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 52 guests