Posted by Sam Battin, Senior Search Strategist
Do you want to optimize your site's AJAX content for visibility on search engines? Here's Google's grand plan explained!
Recently, Google announced a new technique that will allow better visibility for your site’s AJAX applications. AJAX is a usability technology that delivers instantly updated information to your visitors; it’s like being able to deliver the speed, power and accessibility of a desktop application through a browser. When you use AJAX well, you can encourage longer visits and keep your visitors coming back again and again. To see the potentials of this new technology, try searching for “Good examples of AJAX” on Google. No, seriously, you should do this. Here’s a link:
All right – now that you know what AJAX is, you probably also know that all that awesome stuff it delivers is very tough or even impossible for search engines to see. While your visitors may know that your site offers a fantastic interface that speeds things up beyond what was even conceivable a couple years ago, a search engine won’t send new visitors your way because AJAX is really difficult to crawl.
Search engines are trying to fill this vacuum. The more good results they can offer their users, the more likely it is their users will keep using their search engine. Therefore, exposing your AJAX content to search engines is a win-win situation for you and for search engines. You get more search engine traffic, they get people to keep searching for content.
Hijax – The Existing AJAX Crawl Technique
There are existing techniques to help search engines know about the content your AJAX site offers. One of the most important techniques is called "Hijax." In a nutshell, Hijax means building an HTML architecture for your site and layering AJAX on top of that. Search engines will be able to crawl the HTML on your site because Hijax links combine AJAX content with HREF links they can follow. This allows search engines to see the HTML content you set up to explain the AJAX content of your site; as a result, you can indirectly build visibility for your site’s AJAX content.
The New AJAX Crawling Agreement
You should think about using the new AJAX technique if you’re in the following situation:
a) Your website content changes regularly
b) You want search engines to serve fast AJAX links
c) You have AJAX on your site but you're not using Hijax
So what’s the new technique? Word-for-word, here’s how Google describes it:
- The site adopts the AJAX crawling scheme.
- For each URL that has dynamically produced content, your server provides an HTML snapshot, which is the content a user (with a browser) sees.
- The search engine indexes the HTML snapshot and serves your original AJAX URLs in search results.
Google calls this new scheme an agreement, and it is. You’re agreeing to set up your site in a particular way to gain visibility for your AJAX content. That's probably why Google refers to this whole idea as "The New Agreement," and it makes a lot of sense to use this terminology. Below, we briefly sketch out how this will work.
Make those AJAX URLs Pretty! Right Now!
Basically, to let Google crawl your AJAX content, you "agree" to use a special way of writing the AJAX URLs on your site. Google calls the new URLs you wrote just for them "pretty" URLs. In other words, the new URLs are "pretty" (in the sense of "more attractive") to the search engine.
When Google crawls your site for the first time, they will find the "pretty" AJAX URLs in your site's links. Before Google will attempt to follow these "pretty" links, Google will first rewrite the AJAX URLs to a new URL. Google's URL rewrite changes your site's "pretty" URLs into new "ugly URLs."
Then, Google will request the "ugly" URLs from your server. When your server receives a request for an "ugly" URL, the server will return an HTML snapshot of the AJAX content associated with that URL. Google will index this content and then display the "pretty" URL in search result pages.
So for example, suppose your site uses AJAX to do something cool, like allow two people to conduct an interview by typing back and forth to each other in real time. The URL where all this back and forth typing occurs might be:
Google would not be able to see any of this typed content because it lives behind a hashmark, and Google can’t crawl URLs like that. To allow Google to index your live interview content, you would "agree" to rewrite the interview URL to make it "pretty", e.g. by adding the exclamation point shown below
Google would crawl mysite.com and they would see the link to the "pretty" AJAX URL. Google would then ask to see the contents of this page by submitting an "ugly" URL request to your server. For example, to see the interview content Google might ask for
Your server (being ready for this request) would take an HTML snapshot of the page's interview content and return it to Google. Google would crawl the HTML content and include it on a search result page for relevant queries. The Google search result for your AJAX interview page might look like this:
Of course, the reality is slightly more complicated than we've suggested here, but if your site uses AJAX and you want visibility for your content on search engines, go ahead and take a look at Google's Making AJAX Applications Crawlable.