AMP Ad labelling: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Since the ad controller is not built into AMP pages, ad labelling must be done by the publisher. This guide is an example of how to "hide" the ad tag on an AMP page, provided no ad has been played on a placement. ==Example structure of an ad label== <syntaxhighlight lang="html"> <div class="iqampcenter"> <amp-ad> … </amp-ad> <div class="iqadmarker">Anzeige</div> </div> </syntaxhighlight> *The "iqadmarker" div is positioned behind the amp-ad tag in the HTML cod...") |
No edit summary |
||
Line 55: | Line 55: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[ | [[Category:Ad Technology]][[Category:AMP]] | ||
[[de:AMP Anzeigenkennzeichnung]] | [[de:AMP Anzeigenkennzeichnung]] |
Latest revision as of 09:14, 22 March 2022
Since the ad controller is not built into AMP pages, ad labelling must be done by the publisher. This guide is an example of how to "hide" the ad tag on an AMP page, provided no ad has been played on a placement.
Example structure of an ad label
<div class="iqampcenter">
<amp-ad> … </amp-ad>
<div class="iqadmarker">Anzeige</div>
</div>
- The "iqadmarker" div is positioned behind the amp-ad tag in the HTML code.
- The surrounding div container "iqampcenter" gets additional CSS styling:
display: flex;
flex-direction: column;
- The "iqadmarker"-div gets the CSS styling:
order: -1;
display:none;
- Thus it slips in front of the amp-ad and is not visible at first.
- If an ad is booked, delivered and the amp-ad is displayed as a result, the ad label will appear with the following code:
.iqampcenter > amp-ad:not([hidden]) + .iqadmarker {
display: table;
}
iqampcenter and iqadmarker are of course only example names, which can be replaced by better names.
Summary
For a quick overview, here are the code blocks used again:
HTML structure
<div class="iqampcenter" >
<amp-ad … </amp-ad>
<div class="iqadmarker">Anzeige</div>
</div>
CSS
.iqampcenter {
display: flex;
flex-direction: column;
}
.iqadmarker {
order: -1;
display:none;
}
.iqampcenter > amp-ad:not([hidden]) + .iqadmarker {
display: table;
}