PDA

View Full Version : Where to implement a JavaScript pop-up code


cayne
10-18-2011, 03:38 PM
Hi everybody,
I got the following code, which I need to have on "forumhome" as well as "showthread", I simply added the code to the according templates on vBulletin 3.8.x - but now I've upgraded to v4 and when I just add the code it seems to generate longer loading times/general errors. So I'd like to ask, where's the right place to add such code. Thanks in advance.

Here's the code in question:

<script type="text/javascript" id="adcreative_script">
(function(){
var adcr = document.createElement('script');
adcr.type = 'text/javascript';
adcr.async = true;
adcr.src = '//static.adclickx.com/adcreative.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(adcr);
})();
</script>

Lynne
10-18-2011, 03:41 PM
You would just add them to the FORUMHOME and SHOWTHREAD templates. Or, you could put it in the headinclude and put a condition around it to only show it on those two pages.

cayne
10-18-2011, 03:51 PM
Ah ok, so I simply copy the code to the bottom of the template and that's it? That's what I did before, but like I said, I had the feeling the code was causing weird loading errors this time around. But I have to say I was using a different code back on the v3 version of vBulletin, so maybe it's not the position within the v4 version, but the code itself, or rather the file on the ad-server.

But as long as it's ok to just copy the code into the template I'm relieved.
And thanks for the super-quick response. Much appreciated! :)

Just one more thing, as you said, if I put it into the head-include, it will be loading on all pages? Because that's actually better than just on forum-home and showthread...

Lynne
10-18-2011, 04:49 PM
If you put it in the headinclude template, then that will be on all pages.