Adding Google, Bing, Yandex, and Pinterest Verification Meta Tags to Magento

Meta tags are an easy way to add verification to your Magento store for Google Webmaster Tools, Bing Webmaster Tools, Yandex.Webmaster, and Pinterest for Business accounts. In this article, we’ll go over two easy ways to add these tags to your Magento store.

Magento Tricks by Traffic Motion

One alternative to adding meta tags is to upload a file from each of these sites to your site’s root directory. Unfortunately, when developers, IT, and version control systems are involved, this can be a much longer process than it should be. Instead of taking a few seconds, it may take days or even weeks just to get a new file (let alone four) uploaded to the root directory of your store.

Thankfully, Magento provides a couple of workaround for this, one that is extremely simple, and one that is a little more sophisticaned but cleaner and easier to read and maintain. We’ll start with the simpler method.

Miscellaneous Head Scripts

Log in to the admin section of your store, and navigate to System > Configuration > Design > HTML Head > Miscellaneous Scripts, and simply copy-paste the verification code there.

The code for our TrafficMotion website would look like this:

<meta name="msvalidate.01" content="14B60B177AD73A9CB88E52E10DE81E9F" />
<meta name="google-site-verification" content="Y0KjL1s3sCz5_RnzmBPdNIiMKE7n-iPy3OzjlRlPvdI" />
<meta name="p:domain_verify" content="8c5c5b782d04896448cc802df0e4e97b" />
<meta name='yandex-verification' content='7754504dbf4109f0' />

Easy, right? So what’s the problem with this method?

There really isn’t one, but the scripts are added to the <head> of every page of your site, where Google, Bing, Yandex, and Pinterest only require it on the home page.

To put it simply, why clutter up every page of your site, when you don’t need to? Google or Bing aren’t going to bother verifying the tag on every single page of your store, so why bother including it? It’s just extraneous code for the vast, vast majority of your pages.

So let’s add these pieces of code a different way, and just get them on the home page.

Block & Layout Update

First, navigate to System > Configuration > General > Content Management > WYSIWYG Options. We’re going to change the setting for “Enable WYSIWYG Editor” to “Disabled by Default.” If we don’t do that, Magento’s WYSIWYG editor will strip out the meta tags we’ll be adding to a new static block.

Adding a New CMS Static Block

Once you’ve done that, go to CMS > Static Blocks > Add New Block. You can name it anything you want, but we’ll give it the Block Title of “Validation Codes” and the Identifier of “html_validation_codes” for the purposes of this tutorial.

Then, in the Content, copy-paste in your meta tag verification codes. Now, we just have to get that block into our home page.

Adding the Validation Codes Block to the Home Page

Now, go to CMS > Pages > Home page, and hit the Design Tab under Page Information. This is the part where it can get tricky for new store owners, but it’s really not too difficult.

There may already be some code in the Layout Update XML field if you’re using the base default theme, or it may be empty. In either event, we’re going to add a little snippet of code to reference our Validation Codes static block. Here’s what you would include if you’ve followed along so far:

<reference name="head">
<block type="cms/block" name="validation_code">
    <action method="setBlockId"><block_id>html_validation_codes</block_id></action> 
</block>
</reference>

Wrapping Up Validation Codes

Now, check the Page Source of your Magento store home page, and you should see the block of code just under our customized Google Analytics code. It looks just like this:

<!-- END GOOGLE ANALYTICS CODE -->
<meta name="msvalidate.01" content="14B60B177AD73A9CB88E52E10DE81E9F" />
<meta name="google-site-verification" content="Y0KjL1s3sCz5_RnzmBPdNIiMKE7n-iPy3OzjlRlPvdI" />
<meta name="p:domain_verify" content="8c5c5b782d04896448cc802df0e4e97b" />
<meta name='yandex-verification' content='7754504dbf4109f0' />
<script type="text/javascript">//<![CDATA[
        var Translator = new Translate([]);
        //]]></script></head>

Then, you can check for the code on any other page of your website, and it won’t be there! It’s not a huge savings in terms of the amount of HTML on the page, but it does keep a few lines of extraneous code off of them. No website would pay much attention to those meta tags if they were on every page anyway, so let’s keep the category, CMS, and product pages a little cleaner.

7 thoughts on “Adding Google, Bing, Yandex, and Pinterest Verification Meta Tags to Magento”

  1. As an SEO the finer points of coding present challenges from time to time, especially with bespoke web builds.

    Your invaluable help allowed me to verify in Bing, Alexa and add a Geo Tag in the same block.

    Thank you for taking the time to write very clear instructions!

  2. Er, I really am not good at this stuff but followed all your points very closely.
    Your tutorial was very very easy to follow until adding into the “Layout Update xml” as there was lots of code and I just copied and pasted yours at the end. Was this right?
    Then you advise I can check it…. where? I have no idea what you are talking about here?
    You started so well, but sadly I couldn’t quite finish. Any chance you could advise me here, so I get this right, would be very much appreciated 🙂 Thanks Melinda

    1. Hi, doesn’t look like you’ve got it correct.

      It looks like you put your Pinterest verification tag into the Magento WYSIWYG editor? So it’s outputting the meta tag as a paragraph

      <meta name=”p:domain_verify” content=”831e0ae01d32d74a1389dfb8ed8b445c”/>

      of text, rather than putting it in the of your homepage as a tag.

      Should be an easy fix, but you can always email me if you want more help: nick [at] trafficmotion [dot] com

  3. I’ve tried doing the google verification code by looking for Syetem>Configuration>General>Content Management>WYSIWYG but I can’t find them all under the systems Page. After Navigation to System, all I can find lined up under teh system is My account, tools,manage currency,transactional emails,cache management ,Index management and Manage stores. Why am I not finding the correct sequence?

  4. I followed your instructions to the letter. I’m trying this solution to add verification code for Google Merchant Centre but I can’t see the verification code in the source code, help!

Leave a Reply

Your email address will not be published. Required fields are marked *