The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Question about ntegrating Google DFP asynchronous tags
I'm trying to integrate DFP Google publisher asynchronous tags on our installation; which requires the following header code:
HTML 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('/1013431/TWILike_Forum_160', [160, 600], 'div-gpt-ad-1325472136197-0').addService(googletag.pubads()); googletag.defineSlot('/1013431/TWILike_Forum_300', [300, 250], 'div-gpt-ad-1325472136197-1').addService(googletag.pubads()); googletag.defineSlot('/1013431/TWILike_Forum_728', [728, 90], 'div-gpt-ad-1325472136197-2').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> I've tried enclosed the entire code block in <vb:literal> tags. I've tried enclosing first one block and then the other. But nothing I can do will get that second block to show up. Any advice/suggestions would be greatly appreciated... |
#2
|
||||
|
||||
I'm having the same issue. Any help would be appreciated.
Thanks. --------------- Added [DATE]1325956848[/DATE] at [TIME]1325956848[/TIME] --------------- Okay, I think that I figured out the issue. Perhaps this will help someone else. First, to avoid the "unclosed curly brace expression" error, the code added to the header must be enclosed in <vb:literal> tags as such: Code:
<vb:literal> </vb:literal> Apparently every time that you generate tags, all of the header codes change. So... if you should generate new tags for any reason, you need to go into the headerinclude template and completely replace the header code from before. I hope that this is helpful to someone. |
#3
|
||||
|
||||
Is there a similar way of getting this to work on 3.8? Is there a literal tag, or any easy way of creating the same effect?
|
#4
|
||||
|
||||
Quote:
Basically use a text editor and do a find/replace find: ' replace: \' paste the new code into the template and try again. |
#5
|
||||
|
||||
Hi, thanks for that but unfortunately it's not that simple (I did try after your suggestion).
I think it's to do with the {} or perhaps the fact this code uses function names? In headerinclude I'm putting: HTML 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('/100XX/160sky', [160, 600], 'div-gpt-ad-XX-0').addService(googletag.pubads()); googletag.defineSlot('/100XX/728-90-inpost', [728, 90], 'div-gpt-ad-XX-1').addService(googletag.pubads()); googletag.defineSlot('/100XX/728x90', [728, 90], 'div-gpt-ad-XX-2').addService(googletag.pubads()); googletag.defineSlot('/100XX/468banner', [468, 60], 'div-gpt-ad-XX-3').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script> HTML Code:
<div id='div-gpt-ad-XXXX-0' style='width:160px; height:600px;'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('div-gpt-ad-XX-0'); }); </script> </div> |
#6
|
||||
|
||||
Maybe just put the javascript in an external file and call it the usual way?
http://www.tizag.com/javascriptT/javascriptexternal.php |
#7
|
|||
|
|||
I got it to work by moving all the DFP code to an external .js file. I had to remove the "<script>" and "</script" tags.
Brandon |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|