Optimize Your App for SEO

Does your website component have text or other content that’s meaningful for SEO? Optimize your app for search engine crawlers, to improve SEO for your users.

There are two main steps to optimize your app:

  1. Optimize the app itself in the live site: as search engines like Google can crawl JavaScript, make sure the app itself is fully optimized for SEO.
  2. Develop an SEO endpoint: as not all search engines crawl JavaScript, we’ll call your SEO endpoint when a search engine requests the SEO version of your app

Here are a few examples of apps that should be optimized for search engines:

  • FAQ widgets
  • News ticker widgets
  • Testimonial widgets

If there’s no content in your widget that’s meaningful for SEO, don’t develop an SEO endpoint – we’ll render your widget as an iframe. For example, apps like chat widgets, form builders, and social media buttons don’t need an SEO endpoint.

Optimize your app in the live site

Follow these dos and don’ts to optimize your app for search engines.

Do:

  • Add alt text and src to images: That way, these attributes are easily readable in the DOM.
Copy
1
<img src="images/optimize-your-app-for-seo-md__tmp_git-push-evente159e117b31a43bbdbc5220ee801bbd7_tpa-docs_general_myappimage.png" alt="This is an image of my app! ">
  • Use absolute, schemeless links and add the href attribute: This is the full URL without the protocol. For example:
Copy
1
<a href="//www.myApp.com">Check out this page!</a>
  • Add rel=”noreferrer” for links to other site pages: Have links that go to other pages in the user’s site, like the homepage? Set the rel attribute value to “noreferrer” for links that go to these pages – excluding links to your app’s internal pages. (This ensures that users don’t see your app’s iframe URL as a referrer in Google Analytics.)
Copy
1
<a rel="noreferrer" href="//www.site.com/">Check out this page!</a>
  • Manage internal pages in your app the right way:
  1. Use deep linking to link to internal pages.
  2. Return a 404 error for deleted internal pages.
  3. Set a title and description for internal pages using the setPageMetaData SDK method. These values must match what’s in your SEO endpoint.
  • Title: insert the name of the internal page into the page title. For example, the page name in an eCommerce app would be the name of the product, e.g., ‘Green Hoodie’.
  • Description: we recommend using the first 160 characters from the page content, or allowing users to customize the description.
  • Use <h1> only for internal pages: for the app’s main page, don’t use <h1>. Use <h2>, <h3>, and so on, according to your app’s hierarchy.

Don’t:

  • Add a noindex meta tag: Google can crawl JavaScript, so don’t block search engines from crawling JavaScript in your app’s iframe.
  • In the robots.txt file, don’t block anything that’s needed for the page to load: contact us if you think something should be blocked.

Develop an SEO Endpoint

Create a separate HTML file for the SEO endpoint. Your SEO endpoint should be an “HTML snapshot” – a  stripped down version of your app that has all the static HTML content visible on the user’s site, and none of the JavaScript or dynamic functionality.

Here are some important things to keep in mind when creating your SEO endpoint:

  • For your app’s main page, only include the tag: Include visible content only – headings, lists, images, etc.
  • Don't include or tags in the element: leave this data for the user to define.
  • Don't include
  • Make sure the elements match the app itself. For example, the heading structure, alt text for images, etc.
  • Link to your app’s internal pages: deep link to internal pages, and use absolute, schemeless links. For example:
Copy
1
<a href="//www.site.com/product-page/green-hoodie"> Green Hoodie </a>
  • For internal pages, include both the and : unlike the app’s main page, you should include tags in the element for internal pages:
  1. Add the title and description you already set in the app via the setPageMetaData SDK method.
  2. Add Open Graph tags for social media (title, type, URL and image).
Copy
1
//Example of an internal product page in an eComm app
2
<head>
3
<title> Page/Product Name</title>
4
<meta name="description" content="Page/Product Description">
5
<meta property="og:title" content="Page/Product Name" />
6
<meta property="og:type" content="website" />
7
<meta property="og:url" content="//www.site.com/product1/" />
8
<meta property="og:image" content="//www.site.com/product1/myProduct.png"/>
9
</head>
  • Don’t display content in the SEO endpoint that isn’t visible in the app: search engines consider this to be bad practice, since it’s usually done to manipulate SEO ranking. Search engines detect this, and may remove suspect pages or the entire site from their index. E.g., if your app doesn’t include marketing text like “powered by MyCompany” – then don’t include it in the SEO version.
  • Support SEO in other languages: after you render the HTML for your SEO view, include an additional header in your HTTP response: Content-Type: “text/html;charset=UTF-8”.
  • Make sure your endpoint is up, publicly accessible, up-to-date, and fast:

- Define a publicly accessible URL (don’t use a localhost hostname).

- Keep the error rate low – otherwise, we’ll turn off your SEO endpoint.

- Update the content dynamically so that it reflects the current content in the app.

- Load the endpoint within 4 seconds.

SEO Endpoint examples

Widget component examples

App HTML

Copy
1
//App HTML includes JS
2
<html>
3
<body>
4
<h1>JavaScript Loops</h1>
5
<p id="demo"></p>
6
7
<script>
8
var cars = ["BMW", "Volvo", "Saab", "Ford", "Fiat", "Audi"];
9
var text = "";
10
var i;
11
for (i = 0; i < cars.length; i++) {
12
text += cars[i] + "<br>";
13
}
14
document.getElementById("demo").innerHTML = text;
15
</script>
16
17
</body>
18
</html>

Static Endpoint

Copy
1
//Static HTML code that displays the visible content
2
<body>
3
<p id="demo">
4
BMW<br>
5
Volvo<br>
6
Saab<br>
7
Ford<br>
8
Fiat<br>
9
Audi<br>
10
</p>
11
</body>

Page component examples

App HTML

Copy
1
//App HTML page includes JS
2
<html>
3
<body>
4
<h2>HEADING</h2>
5
<p id="divid"></p>
6
7
<script>
8
var car_name = ["Mazda", "Volvo", "Nissan", "Ford", "Skoda", "Audi"];
9
var string = "";
10
var i;
11
for (i = 0; i < car_name.length; i++) {
12
string += car_name[i] + "<br>";
13
}
14
document.getElementById("divid").innerHTML = string;
15
</script>
16
17
</body>
18
</html>

SEO Endpoint

Copy
1
//Static HTML code that displays the visible content
2
<body>
3
<h2>HEADING</h2>
4
<p id="divid">
5
Mazda<br>
6
Volvo<br>
7
Nissan<br>
8
Ford<br>
9
Skoda<br>
10
Audi<br>
11
</p>
12
</body>

Internal page component examples

App HTML

Copy
1
//App HTML page includes JS
2
<html>
3
<head>
4
<title>INTERNAL PAGE TITLE </title>
5
<meta name="description" content="INTERNAL PAGE DESCRIPTION"/>
6
</head>
7
<body>
8
<h2>HEADING</h2>
9
<p id="divid"></p>
10
11
<script>
12
var car_name = ["Mazda", "Volvo", "Nissan", "Ford", "Skoda", "Audi"];
13
var string = "";
14
var i;
15
for (i = 0; i < car_name.length; i++) {
16
string += car_name[i] + "<br>";
17
}
18
document.getElementById("divid").innerHTML = string;
19
</script>
20
21
</body>
22
</html>

SEO Endpoint

Copy
1
//Static HTML code that displays the visible content
2
<html>
3
<body>
4
<head>
5
<title>INTERNAL PAGE TITLE </title>
6
<meta name="description" content="INTERNAL PAGE DESCRIPTION"/>
7
</head>
8
9
<h2>HEADING</h2>
10
<p id="divid">
11
Mazda<br>
12
Volvo<br>
13
Nissan<br>
14
Ford<br>
15
Skoda<br>
16
Audi<br>
17
</p>
18
19
</body>
20
</html>

Check your app’s SEO view

You can see what your app looks like to a search engine crawler – whether or not you developed a dedicated SEO endpoint by accessing the site / page with a Googlebot.

 Here’s how to do it in Google Chrome:

  • Right click anywhere on your page and click Inspect.
  • Click Menu in the top right > More tools > Network conditions
  • Under 'User agent' uncheck 'Use browser default'
  • Select a Googlebot from the dropdown or paste one into the Custom field

For browsers like Edge, Firefox and Safari, check out this article.

Was this helpful?
Yes
No