How we hacked the Baidu link submission script for better indexation

Baidu's Link Submission Script is a great way to help Baidu index your content, but it can create some potential SEO issues. Columnist Hermes Ma shares an improved version of the script that is more SEO-friendly.

Chat with SearchBot

Baidu Search Ss 1920

It is no secret that the Baidu Link Submission Script is an effective tool for surfacing links that are not quite visible to Baidu spiders. In Baidu’s own words (translated from Chinese):

The JavaScript snippet pushes links to Baidu directly; it serves all platforms, as well as both desktop and mobile devices. Your page is discovered by Baidu the moment of its first page view, which accelerates the progress of new content discovery.

By inserting the snippet into the source code of pages that you want Baidu to discover and index, it pushes the URL of the current page to Baidu automatically.

Baidu Link Submission Script

Baidu Link Submission Script

How the script works

The script simply checks the protocol of your page and selectively downloads a JavaScript (JS) file from Baidu. It copies the script in the file and creates a node of <script> on your page. The copied script then takes the URL of the current page, plus the referrer URL of the page, as the parameters when requesting a GIF file (a 1×1 pixel GIF for carrying the parameters) from Baidu.

Every time a visitor browses the page, the script is executed and Baidu will be notified. For example, if you were to drive a considerable amount of traffic to the pages, Baidu would know how important and popular the content is.

As you can see, the code snippet is straightforward and open to other configurations. For example, you may use it as an impression-tracking pixel. That gives us reason to believe that it won’t get high priority at Baidu. To be honest, we don’t think this will improve your ranking on Baidu. However, it does help the indexation of your site to some extent.

How we improved it

As a veteran of SEO, you may have noticed that submitting the URL of the current page does not follow the best practices, because:

  • the URL may not be the canonical URL you want the engine to index.
  • the script makes an extra request which is unnecessary and potentially slows down the page load speed.
  • furthermore, those two JS files are static and are mostly identical, except the URL of the GIF you are requesting.

In order to tackle those issues, my colleague Woody Chai and I have tweaked the Baidu script a bit. See the code snippet below.

The improved Baidu Link Submission Script by Merkle

The improved Baidu Link Submission Script by Merkle

In the code snippet above, we added a step to check if the canonical directive exists and hard-copied the script by merging those two JS files. Now, we can push the canonical URL to Baidu by only one HTTP(S) request.

Last thoughts

In this example of the improved Baidu Link Submission Script, we have demonstrated how we can make the script Baidu gave us more SEO-friendly. There is one thing you should keep in mind: The scripts (including the URL of the GIFs Baidu put in those JS files) may be changed in the future, though it hasn’t changed since day one. If you find any 404s of those resources, or any sign that the script is lagging the page load speed, you should go back to Baidu Webmaster Tools for updated solutions.

Code snippet


Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.


About the author

Hermes Ma
Contributor
Hermes Ma is a digital marketer and writer. He owns Merkle's search business in Greater China. Hermes has an experience in search marketing and web analytics of over a decade, both in and out of the Chinternet. He writes his blog at maxket.com (Chinese) and he also guest-blogs at Baidu Webmaster Tools. Hermes is a hardcore gamer. He ranked at Top 1,000 of PlayStation Asia. If you don't see him playing games after work, he's probably spending time with his lovely son.

Get the must-read newsletter for search marketers.