DFP - No longer working if ID is populated from database

26 Views Asked by At

I want to change our DFP ad slots to be populated from the database but when I do this it does not display. It works fine if the IDs are static.

It loads the right structure up until the iframe but then the body in the iframe is empty.

I'm guessing I need to wait until the dom is ready to run the scripts or something similar?

I'm populating the IDs with Laravel blade.

Please see code below:

<div id="{{ $dfpData['advertisers'][0]['id'] }}" class='center-margin' style='height:728px; width:90px; margin-left: auto; margin-right: auto; display: none;'>
    <script>
          googletag.cmd.push(function() { googletag.display('{{ $dfpData['advertisers'][0]['id'] }}'); });
    </script>
</div>
0

There are 0 best solutions below