1

We have a site which sells items online only for US customers. The site checks the location based on IP and decides if the price should appear on not. Customers from other locations can buy the products offline (for a different price). Searching Google for " price" shows the price in the US in the result's description. On the webpage the user will not see that price if he's not in the US.

How can I prevent Google from showing the prices? I thought about using javascript or checking for bots and hiding the price from them. Is there a simpler solution? Which option is best?

1

There are two ways you could handle it - unfortunately both are not ideal solutions...

  1. You could remove the microformats markup from your pages - but this will affect the people both in the US and outside looking at your results

  2. You could create different versions of your website for different countries to be indexed in results for these countries. This will take a lot of work and set up and also you will need to wait for Google to change their results (and in the end they still decide what they show)

It looks like there is no easy answer here and your users might just have to be content with seeing different prices in search results and getting different prices when buying from resellers.

0

What I finally did was to always block the price to bots.

Used a code similar to this:

function _bot_detected() {

  if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
    return TRUE;
  }
  else {
    return FALSE;
  }

}

More info at: https://stackoverflow.com/questions/677419/how-to-detect-search-engine-bots-with-php

2
  • Google considers such cloaking a violation of their guide lines for webmasters: support.google.com/webmasters/answer/66355 – Hagen von Eitzen Jul 24 '16 at 10:04
  • for future readers - this is definitely not cloaking as defined in the violating sense. Using this code for years now with no problems. Google receives the "normal" page. Only specific users (based on IP and browser) can also see prices. – Livshin Feb 26 '18 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.