Issue with adwords

Hi Kento,

I can’t get the LazyLoader plugin to work with adwords. There’s multiple adwords inline js inside sidebar widgets, and wrapping them in the plugin shortcode completely breaks the adwords script.

This is also the case with the free Lazy Widget Loader plugin; checking LazyLoad causes the entire ad not to show up.

Any help or insight into what the issue is and suggestions on a fix would be amazing – it’s driving me mad. *Thank you*

do_shortcode is enabled for the widgets, of course.

Here’s an example ad:

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);
})();

googletag.cmd.push(function() {
googletag.defineSlot(‘/25826578/tbg_home_box_1’, [300, 250], ‘div-gpt-ad-1352919555309-0’).addService(googletag.pubads());
googletag.defineSlot(‘/25826578/tbg_home_box_2’, [300, 250], ‘div-gpt-ad-1352919555309-1’).addService(googletag.pubads());
googletag.defineSlot(‘/25826578/tbg_home_box_3’, [300, 250], ‘div-gpt-ad-1352919555309-2’).addService(googletag.pubads());
googletag.defineSlot(‘/25826578/tbg_home_box_4’, [300, 250], ‘div-gpt-ad-1352919555309-9’).addService(googletag.pubads());
googletag.defineSlot(‘/25826578/tbg_home_btf_lb’, [728, 90], ‘div-gpt-ad-1352919555309-8’).addService(googletag.pubads());
googletag.pubads().collapseEmptyDivs();
googletag.enableServices();
});

googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1352919555309-0’); });


Comments

One response to “Issue with adwords”

  1. Hi Ryan,

    Can you provide a link to the page where it’s used please? If there are Javascript errors and other resources loaded, it can help us to see what’s going wrong with it.

    If needed: use the Custom Post Widget and the Widget Logic plugins to have it appear on a test page only so it doesn’t affect all pages on the main site.

Share