Info
Content

Working with Twitter

Twitter Codes are a bit special in the sense that they contain a static and a dynamic part. In order to block Twitter codes, please apply the changes demonstrated in the following codes.

Embedding Tweets

Original code before changes:

<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&amp;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&amp;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&amp;ref_src=twsrc%5Etfw">#GDPR</a> <a href="https://t.co/BHAvirWTCp">pic.twitter.com/BHAvirWTCp</a></p>&mdash; 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> 

New Code after changes

<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&amp;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&amp;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&amp;ref_src=twsrc%5Etfw">#GDPR</a> <a href="https://t.co/BHAvirWTCp">pic.twitter.com/BHAvirWTCp</a></p>&mdash; 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> 

The following changes have been applied:

  • Add CSS class cmplazyload to <blockquote ...>
  • Add data-cmp-hide="1" data-cmp-vendor="s34" to <blockquote ...>
  • Add type="text/plain" class="cmplazyload" data-cmp-preview="500x700" data-cmp-vendor="s34" to <script ...> and adjust the height/width as needed (e.g. change 500x700 to 300x300)
  • Change src="..." to data-cmp-src="..." in <script ...>

Embedding Timelines

<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> 

New code after changes:

<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> 
Back to top