Travailler avec Twitter
Les codes Twitter sont un peu spéciaux en ce sens qu'ils contiennent une partie statique et une partie dynamique. Afin de bloquer les codes Twitter, veuillez appliquer les modifications illustrées dans les codes suivants.
Intégration de tweets
Code d'origine avant les modifications:
<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>
Nouveau code après modifications
<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>
Les modifications suivantes ont été appliquées:
- Ajouter une classe CSS
cmplazyload
à<blockquote ...>
- Ajouter
data-cmp-hide="1" data-cmp-vendor="s34"
à<blockquote ...>
- Ajouter
type="text/plain" class="cmplazyload" data-cmp-preview="500x700" data-cmp-vendor="s34"
à<script ...>
et ajustez la hauteur / largeur au besoin (par exemple, changez 500x700 en 300x300) - Modifier
src="..."
àdata-cmp-src="..."
in<script ...>
Intégration des chronologies
<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>
Nouveau code après modifications :
<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>