LEARNING OBJECTIVES โต
- Understand the purpose, layout, and client-side behavior of the Twitter
appCard. - Master platform-specific metadata tags for Apple iPhone, Apple iPad, and Google Play.
- Configure custom URI schemes (
myapp://) and Universal Links for deep link routing. - Implement multi-region store localization using
twitter:app:countryto prevent App Store lookup failures.
๐ The Mental Model & Story (Intuitive Foundation)
Imagine printing a billboard advertising a smartphone game. Instead of simply showing a picture of the game, the billboard has a smart NFC sensor: when an iPhone user taps it, their phone immediately opens the Apple App Store on the download screen with the install button pre-focused; when an Android user taps it, Google Play opens instantly. Even better: if the user already has the game installed, tapping the billboard launches the game and lands them directly on Level 15.
+-------------------------------------------------------------------------------+
| THE APP CARD: DIRECT INSTALL & DEEP LINKING |
+-------------------------------------------------------------------------------+
| +--------------+ Acme TaskFlow: Collaborative Project Manager |
| | [APP ICON] | Free โข โ
โ
โ
โ
โ
(4.8 / 5 - 12.4k ratings) |
| | 160x160 | Organize sprints, track epics, and sync Kanban boards. |
| +--------------+ |
| |
| [ GET / INSTALL ] <--- Tapping button opens App Store or launches app via |
| custom deep scheme: `taskflow://projects/402` |
+-------------------------------------------------------------------------------+
The App Card (twitter:card="app") is a specialized Twitter Card format designed to maximize native mobile application installs. Twitter fetches application metadata directly from the Apple App Store and Google Play APIs (including app icon, rating, pricing, and download buttons) and handles intelligent deep linking.
Technical Deep Dive & Specifications
App Card Architecture & Resolution Pipeline
When an App Card is shared, Twitter's backend takes the declared App IDs, queries the respective platform app stores, and constructs a dynamic native UI component:
[ Developer Defines App Card Meta Tags ]
โ
โผ
[ Twitterbot Scrapes Document ]
โโโ Extracts twitter:app:id:iphone (e.g. 123456789)
โโโ Extracts twitter:app:id:googleplay (e.g. com.acme.taskflow)
โโโ Extracts twitter:app:country (e.g. US)
โ
โผ
[ Twitter Backend Queries App Store APIs ]
โโโ Apple iTunes Lookup API (Fetches icon, rating, category, price)
โโโ Google Play Store API (Fetches badge, developer, reviews)
โ
โผ
[ Mobile Client Device Detection ]
โโโ iOS Device: Displays "Install on App Store" + Executes twitter:app:url:iphone
โโโ Android Device: Displays "Get it on Google Play" + Executes twitter:app:url:googleplay
โโโ Desktop Web: Renders fallback summary banner linking to the web URL
Complete App Card Specification Matrix
| Property | Required / Optional | Platform | Description & Value Example |
|---|---|---|---|
twitter:card |
Required | All | Must be set to "app". |
twitter:description |
Recommended | All | Short summary of the app (max 200 characters). |
twitter:app:country |
Optional | All | Two-letter ISO country code (e.g. US, GB, IN, DE). Defaults to US. |
twitter:app:name:iphone |
Required (iOS) | iPhone | The display name of the application on iPhone. |
twitter:app:id:iphone |
Required (iOS) | iPhone | The numeric Apple App Store ID (e.g. 307234931). |
twitter:app:url:iphone |
Optional | iPhone | Custom deep link URI scheme (e.g. taskflow://dashboard/123). |
twitter:app:name:ipad |
Optional | iPad | The display name of the application on iPad. |
twitter:app:id:ipad |
Optional | iPad | The numeric Apple App Store ID for iPad. |
twitter:app:url:ipad |
Optional | iPad | Custom deep link URI scheme for iPad. |
twitter:app:name:googleplay |
Required (Android) | Android | The display name on Android. |
twitter:app:id:googleplay |
Required (Android) | Android | The fully qualified package name (e.g. com.acme.taskflow). |
twitter:app:url:googleplay |
Optional | Android | Custom deep link URI scheme for Android. |
Deep Linking Mechanics: Custom Schemes vs. Universal Links
When configuring twitter:app:url:*, you specify the path inside your mobile application where the user should land:
1. Custom URI Schemes:
twitter:app:url:iphone => "taskflow://teams/engineering/boards/alpha"
2. Universal / App Links (HTTPS):
twitter:app:url:googleplay => "https://taskflow.app/teams/engineering/boards/alpha"
If the user has the app installed on their phone, tapping the card launches the native application directly to that board. If the app is not installed, the card redirects them to the App Store or Google Play download page.
๐ป Interactive Code Playground
Starter Code
Line-by-Line Code Breakdown
- Line 8 (
<meta name="twitter:card" content="app">): Tells Twitter to construct the native App Store install widget. - Line 9 (
<meta name="twitter:site" content="@TaskFlowApp">): Associates the card with the corporate mobile app account. - Line 10 (
<meta name="twitter:description" content="...">): App summary text displayed on desktop and tablet fallbacks. - Line 11 (
<meta name="twitter:app:country" content="US">): Directs Twitter's scraper to query the United States Apple App Store and Google Play catalog for pricing and ratings. - Line 14โ16 (iPhone block): Provides the app name, numeric App Store ID (
1458920193), and custom deep link scheme (taskflow://...). - Line 24โ26 (Google Play block): Provides the app package identifier (
com.acme.taskflow) and Android deep link URL.
Expected Social Card Render Output (on iOS)
+-------------------------------------------------------------------------------+
| +--------------+ Acme TaskFlow |
| | [APP ICON] | Productivity โข โ
โ
โ
โ
โ
(4.9 / 5.0) |
| | 160x160 | Free (In-App Purchases) |
| +--------------+ |
| |
| Streamline team sprints, track blockers in real-time, and manage Kanban... |
| |
| [ INSTALL / OPEN IN APP ] <--- Tapping launches taskflow://... or App Store |
+-------------------------------------------------------------------------------+๐๏ธ Hands-On Exercise
๐ฏ The Challenge: Implement an App Card for a Crypto Wallet
Instructions:
- Create an HTML landing page for a mobile crypto wallet named "VaultPay".
- Declare the Twitter Card type as
app. - Set the publisher site to
@VaultPayWallet. - Configure the UK App Store region (
GB). - Configure iOS: Name "VaultPay: Secure Crypto", Numeric ID
987654321, Deep Link URIvaultpay://wallet/send?token=ETH. - Configure Android: Name "VaultPay: Secure Crypto", Package ID
com.vaultpay.wallet, Deep Link URIvaultpay://wallet/send?token=ETH.
๐ Starter Code Sandbox
โ ๏ธ Common Pitfalls
- Using URLs for
twitter:app:id:*: Providinghttps://apps.apple.com/app/id12345instead of the raw numeric ID12345or providing a Google Play URL instead of the package namecom.example.app. Twitter's lookup API requires raw IDs, not web links. - Country Code Mismatch: If your app is exclusively available in the German App Store (
DE) but you omittwitter:app:country(defaulting toUS), Twitter's US lookup API will return "App Not Found" and fail to build the card. - Unregistered Custom URI Schemes: If the user has not installed the app and you provide a custom scheme that is not registered with the operating system, older mobile web views may throw an
ERR_UNKNOWN_URL_SCHEMEerror.
๐ก Pro Tips
- Adopt Universal Links for
twitter:app:url: Prefer Universal Links (iOS) and Android App Links (https://app.example.com/deep/path) over custom schemes (example://...). Universal Links fall back cleanly to your responsive website if the app is not installed. - Supply Open Graph Fallbacks: When an App Card is viewed on desktop web browsers (where native mobile install buttons cannot execute), Twitter uses your fallback
og:imageandog:descriptionto render a clean summary banner. Always include standardog:*tags alongside your app card tags.
๐ Key Takeaways
twitter:card="app"generates direct mobile install cards integrated with Apple App Store and Google Play APIs.- For iOS, supply the raw numeric App ID (
twitter:app:id:iphone); for Android, supply the Java package identifier (twitter:app:id:googleplay). - Set
twitter:app:countryto the two-letter ISO country code if your app is geo-restricted outside the US. - Deep linking allows already-installed apps to open specific in-app views via
twitter:app:url:*. - Always provide Open Graph fallback tags for desktop web browser compatibility.
- --