Back to Blogs

How to Set Up a Twitter Card for Your Ecommerce Site

Updated On:21-September-2016

With a bit of data, online retailers can improve the way products are shared on Twitter, defining a specific image and description to be displayed and improving tracking with Twitter Card Analytics.

Online retailers want shoppers to share products on social media. When a visitor tweets about a product, she is essentially endorsing that product, sharing the product with her friends and family. That sort of sharing can lead to sales.

How Twitter Cards Work :

When someone posts a tweet that contains a URL, Twitter fetches the page content and looks for specific metadata fields. When those fields are present, Twitter will display a “card” rather than just a link when the tweet is expanded in the timeline or when the tweet is viewed directly.

Ultimately, the person tweeting can still impact or override how the tweet will appear, but including the Twitter Card metadata will provide a baseline of sorts so that your products are most often presented with an image and product description that your site defines.

Each piece of metadata is a key-value pair. This sort of arrangement will be familiar to web developers — the “key” is a unique data identifier and the “value” is the data itself or a pointer to the data. Also, Twitter Card metadata can typically be added programmatically in an ecommerce platform’s theme or template files.

In the example code below, the key is “twitter:card” and the value is “summary.”

<meta name="twitter:card" content="summary" />

Add Twitter Card Metadata to Product Pages :

Metadata is placed in the head section of an HTML document. For Twitter Cards to work, there are a few required metadata fields.

The first field identifies the card type. Twitter previously offered a “product” card specifically for ecommerce, but Twitter deprecated it in 2015. This left online retailers with two card types for product detail pages: the “summary” card and the “summary with large image” card.

The summary card will display an image with an inline description.

             <meta name="twitter:card" content="summary" />

The summary with large image uses a larger image with a description below it.

           <meta name="twitter:card" content="summary_large_image" />

The site metadata field tells Twitter the handle for the website. For example, the metadata below comes from the Beardbrand and points to Beardbrand’s Twitter handle.

              <meta name="twitter:site" content="@beardbrand"/>

The description meta tag passes a description for Twitter to display on the card. Try to keep this description relatively short.

                     content="Black Marble beard oil is a collaboration..."/>

It is worth mentioning that Twitter bases its card meta fields on Facebook’s Open Graph. So for a few tags, including description, you can use the Facebook Open Graph tag instead. This way, you do not have to create almost identical meta tags for the two platforms. Bottom line, if you have an Open Graph description meta field, use it for your Twitter card too.

                             content="Black Marble beard oil is a collaboration..." />

Similarly, you can provide Twitter with a product name for the Twitter Card with either a “twitter:title” or an “og:title” meta field. Here are the two examples.

                          content="Black Marble Beard Oil - LIMITED EDITION" />

                         content="Black Marble Beard Oil - LIMITED EDITION" />

When you pass Twitter the image URL, you may again choose to use Twitter’s card-specific field or Facebook’s Open Graph field.



Twitter allows you to set the image’s alt property, “twitter:image:alt.”

Test and Launch Your Product’s Twitter Card :

Once you have the Twitter Card metadata included on your site, test it using the Twitter Card Validator. This simple tool will give you an idea of how your card will look. If the Twitter Card fails, use the troubleshooting page to help resolve the problem.

If you are happy with how the Twitter Card works in the validator, try tweeting the URL on your own Twitter account. Twitter Cards appear on Twitter Analytics. You can therefore track how your product pages are shared on Twitter.

Finally, it can take a few days for Twitter to begin honoring your Twitter Card. If the Card is not working as expected in, say, a week, return to the validator and troubleshooting pages.

Article Source From


Image Courtesy