Part2 – App Indexing To Connect Your Android App

As mobile apps become more pervasive, users are looking for relevant information not only from web sites but also from apps they have installed. You can enable Google to crawl through your app content and present your Android app as a destination to users through Google Search results, when that content corresponds to a web page that you own.

You can make it possible for Google Search to open specific content in your app by providing intent filters for your activities. Google Search app indexing complements this capability by presenting links to relevant app content alongside links to your web pages in users’ search results. Users on mobile devices can then click on a link to open your app from their search results, allowing them to directly view your app’s content instead of a web page.

In my previous post I have explained One way of app indexing which is Enabling Deep Links for App Content . Now here in This tutorial we will learn how to annotate web site metadata to allow Google’s algorithms to index app content. (Specifying App Content for Indexing)

Explore app indexing more by seeing below video:

Specifying App Content for Indexing

Google’s web crawling bot, which crawls and indexes web sites for the Google search engine, can also index content in your Android app. By opting in, you can allow Googlebot to crawl the content in the APK through the Google Play Store to index the app content. To indicate which app content you’d like Google to index, simply add link elements either to your existing Sitemap file or in the element of each web page in your site, in the same way as you would for web pages.

The deep links that you share with Google Search must take this URI format:

 

android-app://<package_name>/<scheme>/<host_path>

 

 

Add Deep Links in Your Sitemap
To annotate the deep link for Google Search app indexing in your Sitemap, use the tag and specify the deep link as an alternate URI.

For example, the following XML snippet shows how you might specify a link to your web page by using the tag, and a corresponding deep link to your Android app by using the tag.

 

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

 

 

Add Deep Links in Your Web Pages

Instead of specifying the deep links for Google Search app indexing in your Sitemap file, you can annotate the deep links in the HTML markup of your web pages. You can do this in the section for each web page by adding a tag and specifying the deep link as an alternate URI.

For example, the following HTML snippet shows how you might specify the corresponding deep link in a web page that has the URL example://gizmos.

 

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

 

 

Allow Google to Crawl URLs Requested By Your App

Typically, you control how Googlebot crawls publicly accessible URLs on your site by using a robots.txt file. When Googlebot indexes your app content, your app might make HTTP requests as part of its normal operations. However, these requests will appear to your servers as originating from Googlebot. Therefore, you must configure your server’s robots.txt file properly to allow these requests.

For example, the following robots.txt directive shows how you might allow access to a specific directory in your web site (for example, /api/) that your app needs to access, while restricting Googlebot’s access to other parts of your site.

 

User-Agent: Googlebot
Allow: /api/
Disallow: /

 

To learn more about how to modify robots.txt to control web crawling, see my next blogpost Controlling Crawling and Indexing.

Leave a Comment: