Running javascript to close a div in googleads creative
This page https://www.perlentaucher.de/static/yl-raw.html has a div at the beginning that I want to close.
If I run
parent.document.getElementById('div-gpt-ad-1407836088099-0').style.display='none';
in the console of Google Chrome, the div will close. However if I put this code inside of a google ad manager third party creative. I always get the error "Uncaught TypeError: Cannot read property 'style' of null"
before
after
Doesn't show any error in the console but not working yet :-( Thanks a lot
it does work in the console, but not inside the line item creative :-/
The problem was, that with each new ad unit's creative connected to that one was necessary to add parent. in the code. So at the end it looks like this:
parent.parent.parent.parent.document.getElementById('div-gpt-ad-1407836088099-0').style.display='none';