Arbetar med Twitter
Twitterkoder är lite speciella i den meningen att de innehåller en statisk och en dynamisk del. För att blockera Twitter-koder, använd de ändringar som visas i följande koder.
Bädda in tweets
Originalkod före ändringar:
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">[IAB TCF V2] <br><br>What are the benefits of implementing <a href="https://twitter.com/hashtag/TCF?src=hash&ref_src=twsrc%5Etfw">#TCF</a> V2? <br><br>For publishers: <br><br>⚒️ Greater control<br>🏗️ Provides a technical solution for how to collect and transfer <a href="https://twitter.com/hashtag/personaldata?src=hash&ref_src=twsrc%5Etfw">#personaldata</a> for digital advertising. <br><br>Find out all the benefits: <a href="https://t.co/nWyWAEnSWN">https://t.co/nWyWAEnSWN</a><a href="https://twitter.com/hashtag/GDPR?src=hash&ref_src=twsrc%5Etfw">#GDPR</a> <a href="https://t.co/BHAvirWTCp">pic.twitter.com/BHAvirWTCp</a></p>— IAB Europe (@IABEurope) <a href="https://twitter.com/IABEurope/status/1288439132319100929?ref_src=twsrc%5Etfw">July 29, 2020</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Ny kod efter ändringar
<blockquote class="twitter-tweet cmplazyload" data-cmp-hide="1" data-cmp-vendor="s34" ><p lang="en" dir="ltr">[IAB TCF V2] <br><br>What are the benefits of implementing <a href="https://twitter.com/hashtag/TCF?src=hash&ref_src=twsrc%5Etfw">#TCF</a> V2? <br><br>For publishers: <br><br>⚒️ Greater control<br>🏗️ Provides a technical solution for how to collect and transfer <a href="https://twitter.com/hashtag/personaldata?src=hash&ref_src=twsrc%5Etfw">#personaldata</a> for digital advertising. <br><br>Find out all the benefits: <a href="https://t.co/nWyWAEnSWN">https://t.co/nWyWAEnSWN</a><a href="https://twitter.com/hashtag/GDPR?src=hash&ref_src=twsrc%5Etfw">#GDPR</a> <a href="https://t.co/BHAvirWTCp">pic.twitter.com/BHAvirWTCp</a></p>— IAB Europe (@IABEurope) <a href="https://twitter.com/IABEurope/status/1288439132319100929?ref_src=twsrc%5Etfw">July 29, 2020</a></blockquote>
<script type="text/plain" class="cmplazyload" data-cmp-preview="500x700" data-cmp-vendor="s34" async data-cmp-src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Följande ändringar har tillämpats:
- Lägg till CSS-klass
cmplazyload
till<blockquote ...>
- Lägg till
data-cmp-hide="1" data-cmp-vendor="s34"
till<blockquote ...>
- Lägg till
type="text/plain" class="cmplazyload" data-cmp-preview="500x700" data-cmp-vendor="s34"
till<script ...>
och justera höjden / bredden efter behov (t.ex. byt 500x700 till 300x300) - byta
src="..."
tilldata-cmp-src="..."
in<script ...>
Bädda in tidslinjer
<a class="twitter-timeline"
href="https://twitter.com/consentmanager"
data-width="300"
data-height="300">
Tweets by @consentmanager
</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Ny kod efter ändringar:
<a class="twitter-timeline cmplazyload"
href="https://twitter.com/consentmanager"
data-width="300"
data-height="300"
data-cmp-hide="1"
data-cmp-vendor="s34"
>
Tweets by @consentmanager
</a>
<script type="text/plain" class="cmplazyload" data-cmp-preview="500x700" data-cmp-vendor="s34" async data-cmp-src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>