Fixed Advertising widget

BassMan

Well-known member
Affected version
XF 2.0 RC2
1510777663736.webp

This happens when I add an ad to position Thread View: Above message list and Container Content: Above (this two I've tested so far) with a widget in Thread View: Sidebar.
 
I've found that thread on your forum. Could you just re-enable the ad temporarily please and I'll take a look. It might not be a bug, but just the styling used for the ad.
 
Sorry, now I see it shows ok when you're logged out. If you're logged in it shows like in picture in first post of this thread.
 
I've registered now but I think you might only be showing the ads to guests.

Also, which browser was the screenshot taken with?
 
Sorry, Chris, I'm just setting up things on that forum... Yes, ads are visible to guests, mods and admins for now. I've set you as moderator now if you check again.

The screen was taken in latest Chrome (cache cleared etc.), but in new Firefox all looks good.
 
I'm really not certain we can do anything particular about this. It does look different for me. Sometimes it works fine:

1510838253894.webp

It seems to be down to what size ad is loaded in the slot. Sometimes a much wider ad is shown. Though also sometimes an ad is shown but it overflows to the sidebar when it doesn't need to.

Clearly you're using some sort of responsive ad code. Is there any way to define an upper width? I note there's a display: block; and height: 90px defined on the <ins> element - did you add that? Removing that might help (it shouldn't be necessary) and it seems as though making the height 90px causes problems in some cases.

Testing this is somewhat difficult as I don't have any way of testing it locally.

Would you mind making me an admin? I'll be able to see if there's any adjustments we can make to the styling or markup which might help. The ad code itself might need wrapping in a certain element with certain styling applied so that when the ad slot is filled, it does so within the constraints of that element rather than the entire page width.
 
Ok, you're set as admin now.

It's this Adsense ad type:

1510849208423.webp

Ad size is set to responsive. It worked fine for me in XF1 in any position.

I note there's a display: block; and height: 90px defined on the <ins> element - did you add that?
No, I've done no styling, just copy/paste the ad code.

If you need anything else for testing, let me know.

Thank you for your time.
 
On my board too the responsive advertise unit covers the full width on desktop.
I see it overlap the sidebar and sidebar content goes bihind it

This happens when my sidebar length is more than forum tree length.

Its a page bottom ad unit.

Also both unit look ugly when they covers whole width of forum.
 
In both case on desktop, when side bar length increases beyond forum tree length (when more user comes online and threads with big tittles are posted).
Advertise overlap the sidebar, i seen that many time. This happens when full page width ads is displayed, whe their size is less then they do not overlap
 
I've implemented a workaround for now on that particular ad. I've set it to defer loading rather than asynchronous loading of the adsbygoogle script.

The issue seems specific to Chrome. I'm not sure at this point if there are other workarounds but we'll look into it.
 
Is it somehow depending on adsense responsive ad not knowning the width of the ad-"container"?
I saw the problem earlier today both in threadlist and postlist if I remeber correctly it gets over the sidebar.
 
Thank you, Chris. I see it's a temporary solution to this, I guess.

Also I've noticed on my Galaxy S8 (sorry, can't reproduce in Chrome responsive view):

1510863261505.webp

1510863202762.webp

Maybe it's only specific device
 
This is a difficult issue for us to solve as it's specifically caused by the state of the page/DOM at the exact moment the Adsense JS runs. Given that it runs asynchronously, this can be essentially any time.

It's related to XF2 taking a different (more flexible) approach to how the sidebar/sidenav code is displayed, though this is likely to be sidebar specific, mostly because the sidenav HTML will come earlier in the page. If the browser hasn't laid out the sidebar yet, the main content column will be taking up 100% of the page width. If the async Adsense code runs at this time, it will think it has (say) 1170px to layout its ad; if it runs after the sidebar is laid out, it will get 250px less (correctly).

The problem is that this is really quite internal to the browser rendering engine (and the Adsense JS). The only real options we'd have involve a fair amount of HTML changes to change the approach of the sidebar, and that will certainly have various disadvantages (including reduced flexibility with things like toggleable sidebars).
 
Thank you, Mike. So, if I understand right, that change will be included in RC3?

Also it's interesting it only happens to logged in users. In guest view it's ok.
 
What change? The workaround that Chris made was actually a change to your ad code, which effectively changes when the JS gets parsed (and may also make it semi-synchronous, so it's not ideal). There aren't really changes that I can see us making that will silently and automatically solve it (without breaking other situations).

There may be changes that can be made in the ad code itself that we can make easier.
 
What change? The workaround that Chris made was actually a change to your ad code, which effectively changes when the JS gets parsed (and may also make it semi-synchronous, so it's not ideal). There aren't really changes that I can see us making that will silently and automatically solve it (without breaking other situations).

There may be changes that can be made in the ad code itself that we can make easier.
Ok, sorry, misunderstood something. Thank you.

It's a change in ad code, but it's not working any more. @Chris D ?
 
Back
Top Bottom