Add app deep links on your website

Each page on your site can specify whether its contents should be loaded in your app. We offer several ways to tell Google about the relationship between a web page and a deep link to your app:

  • Using a <link> element in the the <head> section of a page.
  • Using an <xhtml:link> element in the Sitemap <url> element specifying the page.
  • Using Schema.org markup for the ViewAction potential action.

Using the App Indexing API can also surface your app's history in the Google app query autocompletions.

Format of the app URIs

This <link> element specifies an alternate URI (specified in the href attribute) that can be used to open the content in your app. The format of the app URI is:



  • package_name: application ID as specified in the Android Play Store.
  • scheme: the scheme to pass to the application. Can be http, or a custom scheme.
  • host_path: identifies the specific content within your application.

Let's say the package ID for the example.com app is com.example.android. Following are deep links and what the app URI would be for each.

Deep link App URI
http://example.com/gizmos?1234 android-app://com.example.android/http/example.com/gizmos?1234
http://example.com/gizmos/1234 android-app://com.example.android/http/example.com/gizmos/1234
http://example.com/gizmos/toys/1234 android-app://com.example.android/http/example.com/gizmos/toys/1234
example://gizmos?1234 android-app://com.example.android/example/gizmos?1234
example://gizmos/1234 android-app://com.example.android/example/gizmos/1234
example://gizmos/toys/1234 android-app://com.example.android/example/gizmos/toys/1234

If you would like to test to see if your android-app:// URIs are formatted correctly, please use our deep link test tool.

Now let's see how you can add these app URIs to your web pages or sitemaps.

In the HTML of the page http://example.com/gizmos, you add a <link> element as follows for the deep link http://example.com/gizmos:

  <link rel="alternate" href="android-app://com.example.android/http/example.com/gizmos" />
<body> … </body>

Or, if you're using a non-HTTP scheme (e.g., example://gizmo), you would add the following:

  <link rel="alternate" href="android-app://com.example.android/example/gizmos" />
<body> … </body>

You can also annotate the relationship between a page and how to open it in your app using <link> elements in your website's XML Sitemap. For example:

<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  <xhtml:link rel="alternate" href="android-app://com.example.android/example/gizmos" />

Schema.org markup for ViewAction

You can also use markup in the open Schema.org standard to define your app as a handler for the ViewAction potential action. This tells Google (and anyone else supporting Schema.org markup) how to deep link into your app. For example:

<script type="application/ld+json">
  "@context": "http://schema.org", 
  "@type": "WebPage", 
  "@id": "http://example.com/gizmos", 
  "potentialAction": {
    "@type": "ViewAction", 
    "target": "android-app://com.example.android/http/example.com/gizmos"

Update robots.txt

When Google indexes content from your app, your app will need to make any HTTP request that it usually makes under normal operation. However, these requests will appear to your servers as originating from Googlebot. Therefore, your server's robots.txt file must be configured properly to allow these requests. For example, your robots.txt file could include the following:

  User-Agent: Googlebot
  Allow: /

The app's behavior should not change because it or your server detects Googlebot. Consider network calls made from your app with Googlebot to be from a valid user.

Next, learn how to implement the App Indexing API to have your app content surfaced in the Google app query autocompletions.