16 DIY Magento SEO Tweaks

Over the past year, I’ve been learning more and more about optimizing a Magento store. Unfortunately, Magento is not search engine friendly, at least up to Community Edition 1.8 and Enterprise Edition 1.12.

Magento Tricks by Traffic MotionLater releases of the platform may have already solved some of these problems, but a lot of Magento sites out there are on these older versions. Even worse, the cost of upgrading from one version to the next can cost several tens of thousands of dollars, and there is little incentive to do that if the only benefit to doing to is some minor SEO improvements.

I’ve divided up this post into three sections. The first is attempting to speed up Magento, the second is on-site improvements including a subsection on structured data, and the final section is on collecting more data from third party tools like Google Analytics and Webmaster accounts from Google, Bing, and Yandex.

Speeding Up Magento

Server Speed – Hardware & Software

The first thing you should do is either read Magento Site Performance Optimization, or give a copy of the book to your IT team or Magento developers. While not every host will want you running HHVM or have a different type of PHP caching solution, you’ll want to familiarize yourself with how hardware and software on the server can improve your store’s speed.

Improve Speed from the Backend

There are a lot of little tricks and button to press in the Magento System Configuration panels, and some of them may be very useful for incremental gains in speed.

Disable These Four Caches

Oddly enough, disabling a handful of Magento’s caches may actually speed up your site. The reasoning is counterintuitive, but makes perfect sense once you realize the database is the bottleneck at which Magento can get stuck. Allowing Magento to generate these resources on the fly, rather than querying the database to find cached versions that may not exist, can make your server response time increase (or at least stabilize).

.htaccess Tweaks

Whether you’re on NGinx or Apache, there are a number of tweaks you can make to your store’s .htaccess file that can boost your speed. These mostly involve compression and setting expiry headers, but they can make your load faster for new and returning visitors.

On-Site Improvements for Better Crawling

Setting a Unique Home Page Title

While “best practice” for product pages is “Brand Product | Description | Site Brand,” the home page should have the site’s name first. But with how Magento handles title suffixes, you might have a home page title of “Site Brand | Site Brand” if you don’t use this very simple trick to set the home page’s title tag.

Turn Off Category Paths in URLs

This trick was confirmed from Everett Sizemore, but it’s something I’ve recommended. Instead of letting Magento build product URLs with all sorts of different category structures depending on how many categories a product is in, just turn them off. It’s an easy fix in the System > Configuration > Catalog > Search Engine Optimization tab. While you’re there, turn on the Canonical tags.

Cache Breadcrumbs

Magento has a problem in that breadcrumbs are generated the first time a user visits a page (although the breadcrumbs will be different depending on the path they took to get there). Unfortunately, the breadcrumbs are not added to the page cache, so subsequent users and search engines will not have the benefit of seeing the breadcrumb navigation links. This seems like a strange bug, but it’s an easy fix.

NoIndex Filtered Navigation Pages

In order to keep your site from having tons of duplicate content indexed by Google due to all of the different filtered navigation, use this simple extension to set the robots meta tag to NOINDEX,FOLLOW. That way, you can focus the search robots on crawling and indexing the more important pages – categories and product pages.

NoIndex Internal Search Results

While we’re using the scalpel on our pages to keep them out of the search index, let’s get internal searches out of the index. This easy layout update will set the robots meta tag to NOINDEX,FOLLOW on any search results pages that Google or Bing may crawl.

Structured Data Implementation

Basic Schema.org Markup

I can’t do any better than the job Robert Kent did in his book Magento Search Engine Optimization, so just buy that book, follow the instructions for modifying some of your template files, and enjoy easy, valid structured data for your product pages, logo, and any contact info you have on the site.

Extened Schema.org with ProductOntology

One thing I can help you add to your basic Schema.org markup is ProductOntology.org data, which provides external reference classes for each of your products. What’s the benefit? I don’t know. What’s the potential downside? None that I can think of.

Facebook/Pinterest Open Graph Cards

Facebook and Pinterest both use Open Graph markup to provide metadata that they can read and use in enhanced links and pins of your site’s content. Implementing this type of markup is actually very simple.

Twitter Cards

Similarly, Twitter has its own set of meta tags that you can add to your site. The result is more information contained in tweets of your products, including images, prices, and references to your site’s official Twitter page. Again, the implementation is easy.

Collect More Visitor and Search Engine Data

Increase Google Analytics Site Speed Sample Rate

By default, Google Analytics samples 1% of your site’s visitors for server response, page load, and other site speed data. For websites with 50,000 monthly page views, this is only 500 samples per month, which is definitely not enough data to determine if your store is fast or slow. This simple tutorial develops a custom extension to up that sample rate to 10%, which gives you a much better gauge of the performance of your website.

Add Webmaster Verification Meta Tags

Magento has a section in the backend to add miscellaneous tags and scripts to every page of the site. But what if you just want to add tags to your homepage and maintain them in a separate block? Google, Bing, and Yandex require a verification meta tag on the homepage, so why include it on all 10,000 other pages of your site? Let’s keep the HTML cleaner and implement the tags on just one page.

Disable Caches to Make Magento Site Faster? Yes!

Here’s a really cool, useful trick I learned from Mathieu Nayrolles’ new book Magento Site Performance Optimization, published just a couple months ago by PacktPub. While I don’t love every book from Packt, this one is a clear winner, and well worth the cost as either an ebook or paperback.

Magento Tricks by Traffic Motion

Surprisingly, by disabling some of the caches in the Magento store backend, you can actually increase the performance on the frontend. This is primarily reflected in the server response time, and I’ve seen noticeable improvements in server response time from a variety of analytics tools.

Months before reading this book, I wrote a very basic site optimization article on increasing Magento speed from the backend of the site. Consider this strategy an extension of what I wrote there, as most of that advice still holds valid. And remember not to disable the Full Page Cache, or you will have a noticeably slower Magento store.

How To Do It

Navigate to System > Cache Management in your Magento store, and simply disable the following caches:

  • Collections Data (Collection data files.)
  • EAV types and attributes (Entity types declaration cache.)
  • Web Services Configuration (Web Services definition files (api.xml).)
  • Web Services Configuration (Web Services definition files (api2.xml).)

At the end of it, you should have a screen that looks like this:


And that’s it. You’re done. Enjoy a noticeably faster Magento site.

Does This Really Work?

Sure, take a look. This first screenshot is from a Redis integration into a Magento Enterprise store.

Redis analytics

You can clearly see a drop in the response time that Redis is tracking once those caches are disabled.

And here is it from Google Analytics. A little harder to tell, but there is a clear drop-off in the server response time after the caches are disabled.

Google Analytics server response data

“What about the bots?” you ask. Google Webmaster Tools crawl stats shows an even greater differences in how quickly Google itself crawls a website before and after disabling these four caches.

Webmaster Tools crawl stats data

Look at how jagged the lines are before and after the caches are disabled. Googlebot was having a much harder, more inconsistent time crawling the website. It’s still not ideal (faster is always better), but the site is now responding faster for Google as it crawls the webnsite, and there aren’t huge spikes in the data.

All in all, disabling those four caches in Magento can provide a better experience for users and bots, which is what ecommerce and SEO are all about.

Why It Works

According to Nayrolles, this works because it takes Magento longer to check the database to see if these items are cached and then generate them if need be. By simply disabling the caches, Magento does not need to check the cache (a resource-intensive, slow process), and can just generate what it needs on the fly.

I’m not an IT guy, and I can’t say I understand in great depth why this works, but the three independent graphs really speak for themselves. Magento says it’s gotten faster, Google Analytics data gathered from users agrees, and Googlebot itself chimes in to confirm it.

So disable those caches, even for a few days or over the weekend, and see if you get the same results.

How to Add ProductOntology.org Markup to Magento Product Pages

I’ve been thinking of doing a Schema.org for Magento tutorial for some time now, but two things in particular has been stopping me.

For one, there’s little I can do to add to the wonderful job GotGroove.com did on their Evolving Ecommerce blog. They cover it all, from adding the Product Schema, the name, SKU, image, description, and all of the Offer data for every item in Magento.

Magento Tricks by Traffic Motion

Second, Robert Kent, in his book Magento Search Engine Optimization, does just as great of a job — although slightly differently — in implementing Schema.org structured data for Magento stores. He also covers all of the basics to get an ecommerce website using valid markup.

With that in mind, I won’t reinvent the wheel. There’s no point. Just go check out GrooveCommerce and buy Kent’s book from Amazon and do the basic implementation yourself.

What Is Product Types Ontology?

But what I can offer is one further integration for Magento stores. That is, the Product Types Ontology from ProductOntology.org. Product Types Ontology, according to the website, “provides ca. 300,000 precise definitions for types of product or services that extend the schema.org and GoodRelations standards for e-commerce markup.”

What’s the benefit of doing this? To be honest, I’m not quite sure. Google and Bing aren’t using ProductOntology.org class identifiers in their search results pages. However, Google and Bing, by implementing the “additionalType” property on Schema.org, obviously have services of this type in mind.

What ProductOntology.org markup helps us do is add an external link reference to each of our product pages, telling search engine robots, browsers, and other applications more about our products, without including a lot of extraneous, redundant information on the product page itself. Let the product page do what it does best — briefly and accurately describe the item and provide users the opportunity to purchase it. To do this, we’ll be utilizing Schema.org’s “additionalType” property, with a link reference to a class identifier on the ProductOntology.org website.

Implementation Guide for Magento

While I’m sure there would be a more elegant way to do this, for many small and medium sized stores, this should be more than sufficient, and is easy to do without spending precious resources on Magento development. In the future, this type of markup may be worth doing through a custom module or extension, but this guide will at least get us to be able to use ProductOntology.org markup on product pages in any Magento store.

Let’s start with the end. This is what we want the code to look like for each product page:

<link itemprop="additionalType" href="http://www.productontology.org/id/Product_Type">

With “Product_Type” being replace with the actual product type. And where do we get this product type? The Product_Type comes from Wikipedia. Using the Magento demo store’s Canon PowerShot A630 8MP Digital Camera with 4x Optical Zoom as an example, we would search for the most relevant page on en.wikipedia.org, in this case http://en.wikipedia.org/wiki/Point-and-shoot_camera and use the part after “wiki/” as the ID for the ProductOntology.

Creating the Product Ontology Attribute

The first step in Magento is creating a Custom Attribute. In the admin section of your store, navigate to Catalog > Attributes > Manage Attributes > Add New Attribute. We’ll use product_ontology as the Attribute Code, set the scope to Global, set it to a Text Field, and leave everything else as the default values. Use “Product Ontology” as the admin label.

Now, we have to associate the new attribute with a set. Navigate to Catalog > Attributes > Manage Attribute Sets, and click on Cameras. On the right side of the screen, drag product_ontology over to the General section under Groups.

While we’re in the admin area, let’s give a product an ontology! Search for the Canon PowerShot A630 item under Catalog > Manage Products, and navigate to the General tab on the left of the product edit screen. Under Product Ontology, put “Point-and-shoot_camera” in the text field and save the product.

Editing the Product View Template File

Great, so it’s there and associated with a product. But it’s not displaying anywhere on the frontend since we set it not to display on the frontend. We don’t want it in the specifications table since it doesn’t really belong there.

In your Magento installation folder, navigate to magentoroot/app/design/frontend/base/default/template/catalog/product/ and open the view.phtml file.

If you followed the GrooveCommerce Schema.org implementation guide, you should have the Product itemtype already in this file (or the corresponding view.phtml file in your theme). If not, go use their guide now to get up to speed.

Under the <h1> tag for the product name (on or around line 51 of the default store), we’re going to add this single snippet of code to make this whole thing work:

<?php if ($_product->getProductOntology()): ?>
<link itemprop="additionalType" href="http://www.productontology.org/id/<?php echo $_product->getProductOntology() ?>">
<?php endif; ?>

That’s it! We’re done. Check on the frontend that it’s displaying on your site for the Canon A630. The code should look exactly like this:

<div class="product-name">
	<h1 itemprop="name">Canon PowerShot A630 8MP Digital Camera with 4x Optical Zoom</h1>
	<link itemprop="additionalType" href="http://www.productontology.org/id/Point-and-shoot_camera">

Now, whatever type of product you have, you can go to Wikipedia, find the most specific Wiki, grab the last part of the URI, and paste it into the Product Ontology field for any product you offer.

We also used a php if statement that will only display the ProductOntology link reference if the attribute is populated for the product. That way, you won’t have empty href attributes if you add a product and fail to add the Wikipedia class right away.

Updating Product Ontology Data in Bulk

Whether you have a handful or thousands of products, you can easily update the Product Ontology data by doing an export of your product info from Magento, then simply uploading the updates back into Magento. All you need to do is match up the SKU field with the Product Ontology ID that you’ve chosen for each product.

Wrapping Up ProductOntology.org Markup

This solution is quick, clean, and easy enough for even Magento novices to use. It’s also a no-risk way to add more structured data to your website and give search engines and browsers more information about your products.

While this solution works for all products, it could probably be done in a more elegant manner if someone wants to take this idea and run with it and develop a full extension for Magento. If you add new products to your site on a daily basis, filling in the Product Ontology field may become quite a hassle, and leaving the field empty is fairly useless.

However, for smaller ecommerce sites that just want more structured data, and who don’t update their products daily or hourly, this is a great way to add the ProductOntology class identifiers to your site.

Again, is there any tangible benefit to it? I don’t know. That’s why I haven’t dug deeper into this. Unless I see Google rewarding this type of structured data, I can’t recommend going beyond this very simple implementation guide and spending a lot of resources having expensive Magento developers create a custom module for it.