Twitter Widgets Webpage Properties¶
Websites can set widget preferences across their entire website by including
Widget settings specified in a
<meta> may be overridden at the individual widget level. Order of precedence:
- web intent link query parameter
- widget attribute
- widget ID stored preference (embedded timelines only)
- meta or link element
Identify the Twitter profile of the page¶
via property of a Tweet Button by linking to your Twitter profile page with a
me link relationship token.
me link relationship in the
<head> section of your webpage.
<link rel="me" href="https://twitter.com/TwitterDev">
You may also set a
me relationship from an anchor element on your page, such as a Follow Button.
<a class="twitter-follow-button" rel="me" href="https://twitter.com/TwitterDev"> Follow @TwitterDev </a>
<meta name="twitter:widgets:theme" content="dark">
theme = dark
Specify a border color for any Embedded Timelines displayed on the page.
<meta name="twitter:widgets:border-color" content="#ff00ff">
Do not track parameter¶
You may choose whether Twitter widgets on your site help to personalize content and suggestions for Twitter users, including ads. You can opt out of having information from your website used for personalization by following the instructions below.
Include the following snippet within the
<link> elements on your pages that include Twitter for Websites widgets:
<meta name="twitter:dnt" content="on">
You may also opt-out of this data use for a specific widget, and can do so by setting the optional
data-dnt parameter to be true, as shown in the example below:
<a class="twitter-share-button" href="https://twitter.com/share" data-dnt="true"> Tweet</a> <script async defer src="//platform.twitter.com/widgets.js" charset="utf-8"> </script>
Disable functionality which may trigger Content Security Policy warnings¶
An Embedded Tweet or Embedded Timeline may display with restricted capabilities when a Content Security Policy restricts inline loading of Twitter. Set
csp=on to disable functionality which could display Content Security Policy warnings on your site.
<meta name="twitter:widgets:csp" content="on">