3
So I’m having a rather complex problem. Knowing that it is not possible to style with CSS the content of a <iframe>
, I know no other way to achieve the desired goal. I even tried with Javascript, but nothing worked, and some tests I had Crossorigin error, due to trying to 'access' the content of a URL other than the source.
I’m using Google Doubleclick for Business to display ads on a particular site. For those who don’t know what Doubleclick is, an Adserver. It generates a javascript tag and the resulting content on the page will be an HTML with what was defined, in this case unfortunately it uses iframe, somewhat outdated. The problem is that the ads are of fixed sizes (I can set). The service does not have a native responsiveness, ie 100% width for example. Avoiding having to register creative of various different sizes, I want to make them responsive, I managed to do this with the service I currently use.
Tag generated by DFP <head>
<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
</script>
<script>
googletag.cmd.push(function () {
googletag.defineSlot('/21690932511/oregionalsul.com/1200x160_featured', [[1200, 160], [970, 90]], 'div-gpt-ad-1521048007443-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
Tag <body>
<!-- /21690932511/oregionalsul.com/1200x160_featured -->
<div id='div-gpt-ad-1521048007443-0'>
<script>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1521048007443-0'); });
</script>
</div>
Expensive is not having a single piece 100% wide, but a piece for each format. At least according to the documentation... I even did some tests with your ad and it works in the format [320, 700], [300, 250] for example. This should answer your question... https://support.google.com/dfp_premium/answer/3423562?hl=pt-BR
– hugocsl
I have already visited this documentation, but several pieces for an advertisement change the market logic currently applied by the company. For example, 800x600 ads will always be of this ratio, and will resize (100% width and relative height) according to.
– Tiago Boeing
Cara then does the same trick, transforms the animation into GIF and uses as an image placing 100% in width...
– hugocsl
Here is the problem... This is an animated GIF, it is not possible to put 100% wide because the
<iframe>
is generated by the DFP script. Any change via CSS will not affect the content by being inside ìframe. Fiquei um bom tempo tentando forçar algumas tags, classes e ids com
!Mportant` but there’s no way.– Tiago Boeing
Actually I meant to capture the animation of the iframe and convert it into a Gif, like record the screen and save a Gif and then use it in place of the iframe. In fact you wouldn’t even use the iframe in this case, only the Gif you made from the iframe animation. I don’t know if this option suits you...
– hugocsl
That’s what you suggested is just putting the gif directly on the page, isn’t it? So I would ignore the DFP and everything would lose its logic, since the goal of the same is to manage ads. The Adserver that the company currently uses has the option of tags via REST API and others, so it is easy to work with responsiveness, because the generated HTML is explicit with tags like Divs and imgs.
– Tiago Boeing
Since it is not a particular case but a whole workflow I think that really in your case it would not make sense to turn the animation into Gif. I mentioned this option because it’s a practice I used to do when I had a CSS3 animation and I wanted it to work in the old browsers, so I converted the animation into Gif and it was quiet. But sometimes someone comes along with a really functional answer in this case
– hugocsl
I did an update on the question, you probably got it wrong, I have a GIF of the current functioning: https://g.recordit.co/Ypnafarlgd.gif It would be simple if the DFP allowed to put the proportional width, the question is to be able to force the script injection to it.
– Tiago Boeing
It can be in jQuery?
– Sam
Solving the problem will be very well valid. Easy to implement on the preferred page.
– Tiago Boeing