Getting Error: ReferenceError: googletag is not defined

Getting Error: ReferenceError: googletag is not defined


Hi All,

This is my first post to this Forum.

 I am getting following error when trying to use google tags in Ad script.

Error: ReferenceError: googletag is not defined

My Ad script is as follows:

<script type='text/javascript'>
(function() {
var useSSL = 'https:' == document.location.protocol;
var src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt_mobile.js';
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
})();
</script>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/1089059/CarDEkho_MobiSite_320x50', [320, 50], 'div-gpt-ad-1360399534305-0').addService(googletag.pubads());
googletag.enableServices();
});
</script>
<!-- CarDEkho_MobiSite_320x50 -->
<div id='div-gpt-ad-1360399534305-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1360399534305-0')});
</script>
</div>





















Actually we put this ad in header. I got the reason why this script is not working in the header but I need a solution that how can I overcome this issue. Please help me in this regard.


Thanks in advance.