Closed (fixed)
Project:
Doubleclick for Publishers (DFP)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Nov 2013 at 10:40 UTC
Updated:
16 Jun 2014 at 05:42 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jgrubb commentedI'm looking at this exact same thing and will try and get a patch together this week.
Comment #2
bleen commented/me very interested in patch
Comment #3
bogdan1988 commentedActually I tried to use google responsive ads but it didn't worked well for me. I don't know why maybe because I made some mistakes. But what actually I implemented is "adaptive ads". We have mobile (768) and tablet (1024) breakpoints. If page width is bigger then breakpoint then we don't show ads. I hope soon patch will be ready, thx!
Comment #4
bogdan1988 commentedComment #5
bogdan1988 commentedComment #6
bogdan1988 commentedComment #8
jwhat commented4: dfp-add-adaptive-ads-2133053-8170983.patch queued for re-testing.
Comment #10
charlietoleary commentedI would advise against harcoding the breakpoints into the module.
We should let the user supply an ad unit size and corresponding breakpoint like shown in the example from google: https://support.google.com/dfp_premium/answer/3423562?hl=en
Comment #11
bogdan1988 commentedComment #12
jojonaloha commentedAttached patch adds a section to the tag edit form. It functions almost exactly like the targeting, you can add multiple "breakpoints".
This patch does NOT refresh the ads on browser resize though. Because the resize event fires so many times while the browser is being resized I think something like this: http://stackoverflow.com/a/12692647/1316803 should be used. I'm doing that in my theme, but wonder if it should be included in this patch?
Something like:
I do notice one other issue with responsive ads. In my case I was displaying a background takeover ad, except at the mobile size. I was using a 730x200 breakpoint with an ad size of 2000x2000. In order to not display on smaller screens, I had to change the "Size(s)" in the "Tag Settings" section to 0x0. This works properly when the browser starts at less then 730px wide. When you resize to larger and the ads are refreshed, the background ad shows up, as I would expect. However, if you resize back down to <730px wide, the ad still shows up. It looks like this is a known issue and a planned update:
from https://support.google.com/dfp_premium/answer/3423562?hl=en
Last, this patch probably won't apply cleanly to 7.x-1.1 because of changes to _dfp_js_slot_definition(), so you may need to apply some of the changes manually if you are not using the dev version.
Comment #13
bleen commentedAn overarching question first: is there any reason why we should or shouldn't leverage the breakpoint module for the vast majority of this functionality? I have never used it so I am genuinely asking ... could we? should we?
Assuming the answer to that is "thats a bad idea" ... below are some comments. Most are small. By-in-large I think this is a good patch... Another overarching thought though... is there a way to simplify the UI in terms of "size" vs. "responsive settings" ... in a way, they are asking for the same thing, its just that "size" is the default. Thoughts on this?
Should we also be checking for valid screen sizes here? Ex. 1024xhotdog is invalid. Not sure if things will break in this case
nit: Comments should break to the next line if they are more than 80 chars
I think this element needs some descriptive text about what is going on there. "Hey, I just set a size for this ad slot two tabs ago... how is this different?"
I'm not sure I'm right about this, but is it worth considering putting all the breakpoint stuff in a separate .inc file? Meh...
Comment #14
bleen commentedComment #15
hansyg commentedAdded re-rolled patch.
Didn't take a look at breakpoint yet but this patch should get it up and running.
Comment #16
hansyg commentedComment #17
hansyg commentedHold off on this, found a bug. Let me re-roll
Comment #18
hansyg commentedOK all set, mapping working for me on my local
Comment #21
bleen commentedsummary is missing "$" on both lines
Comment #22
hansyg commented@bleen18 that's the javascriptz, not the phpz
Comment #23
hansyg commentedSomething was wrong with the last patch, marked as corrupt. Re-rolled and tested against 7.x-1.x
Comment #25
hansyg commentedMas patches
Comment #26
hansyg commentedPer #12 this patch does NOT refresh the ads on browser resize. You can look the js in 12 if you would like to try that. I don't think it is a good idea to implement here.
As for breakpoint, I couldn't get a real fix on the state of the module with the current threads, I think getting this in is a pretty easy win for mappings.
Comment #27
bleen commentedok ... I'm pretty happy with #25 but before I commit it, this needs some simpletests. We should be testing a) the validation function works properly with different values and b) that given several breakpoints, the correct JS is displayed in the markup. Once we have that, I think we are good to go...
Comment #28
rwohlebI assume the comment in #13 meant the "breakpoints" module, rather than "breakpoint".
https://drupal.org/project/breakpoints
I am currently using the picture module with the breakpoints module. It seems like it would be a good example of usage for anyone evaluating the breakpoints module.
https://drupal.org/project/picture
Comment #29
hansyg commentedInteresting, I would look into this if everyone agrees it is the best path. It will create a module dependency for DFP if we go down that path. Let me know your thoughts @bleen18. I was going to tackle the unit tests this week.
Comment #30
bleen commentedI am very interested in using the break points module to manage the BPs ... Less code to babysit:)
It shouldn't have to be a dependency though. Use if module_exists where needed and voila.
Comment #31
rwohlebI have the patch up and running in our latest staging environments without issue. I'd mark as RTBC, but I see you are waiting on tests to be written.
Comment #32
sphism commentedThis patch works perfectly, great work, thanks to everyone who worked on this.
I just applied the patch, set the breakpoints for 2 sizes, refreshed my page and bingo, 2 different ad sizes for 2 different screen sizes.
I then exported to features, and all seems well.
Comment #33
hansyg commentedAdded requested tests. I think integrating with breakpoints should be another issue, this is working for us.
Comment #34
bleen commentedSold!!
Comment #35
hansyg commentedCommitted to 7.x-1.x
Comment #36
govind.maloo commentedsubmodule for responsive dfp ads.
Comment #37
philpro commentedThe example code here https://support.google.com/dfp_premium/answer/3423562 shows how to exclude ads from appearing within certain breakpoints.
With the current development version I can verify that if you leave the ad dimensions field empty it will indeed exclude the ad from displaying within those breakpoint dimensions. I had to comment out the code in the validation hook to be able to leave the field blank.
I'd like to contribute a fix to allow excluded breakpoints, what would be the best approach? I can open a new ticket if that would be more appropriate.