Website cards automatically render based on the image dimensions. In order to determine the rendered aspect ratio, we now expose two new attributes in website card responses: image_display_width and image_display_height.
These attributes will take the following values:
-
1.91:1
-
"image_display_width": "191" and "image_display_height": "100"
-
5:2
-
"image_display_width": "240" and "image_display_height": "96"
Note that these values do not represent the image dimensions. Rather, they represent the display dimensions.
Below are example website card responses for each aspect ratio.
$ twurl -H ads-api.twitter.com "/1/accounts/18ce54d4x5t/cards/website?sort_by=created_at-desc&count=2"
{
"request": {
"params": {
"count": 2,
"card_type": "website",
"account_id": "18ce54d4x5t",
"sort_by": [
"created_at-desc"
]
}
},
"data": [
{
"name": "mountains",
"image_display_height": "100",
"image": "https://pbs.twimg.com/ad_img/843840604098318337/jSdcsw-9?format=jpg&name=orig",
"preview_url": "https://cards.twitter.com/cards/18ce54d4x5t/3s1yg",
"website_display_url": "twitter.com",
"website_cta": "READ_MORE",
"id": "3s1yg",
"account_id": "18ce54d4x5t",
"website_dest_url": "https://twitter.com/",
"created_at": "2017-03-20T15:04:58Z",
"image_display_width": "191",
"website_title": "1.91:1",
"website_url": "https://www.twitter.com",
"updated_at": "2017-03-20T22:50:23Z",
"deleted": false,
"card_type": "WEBSITE"
},
{
"name": "town",
"image_display_height": "96",
"image": "https://pbs.twimg.com/ad_img/842816037506564096/KnKNjMmQ?format=jpg&name=orig",
"preview_url": "https://cards.twitter.com/cards/18ce54d4x5t/3qy6q",
"website_display_url": "twitter.com",
"website_cta": "READ_MORE",
"id": "3qy6q",
"account_id": "18ce54d4x5t",
"website_dest_url": "https://twitter.com/",
"created_at": "2017-03-17T19:13:32Z",
"image_display_width": "240",
"website_title": "5:2",
"website_url": "https://www.twitter.com",
"updated_at": "2017-03-20T22:09:14Z",
"deleted": false,
"card_type": "WEBSITE"
}
],
"data_type": "card",
"total_count": 2,
"next_cursor": null
}
Example Tweets:
Twitter Ads API Team