1

I was presented with the task of hiding telephone numbers from Google - what that means is, we want to display them on the website and have them clickable href="tel:..." but to ensure Google does not index it and does NOT display it with the search results.

Does anyone know of any effective technique? I was thinking of writing VueJs component, which mixes given number with some alpha characters, but this would only work with the presentation / label, the tel:... would still have to have a valid telephone number and I'm not sure if Google wouldn't pick it form the href attribute.

Sebastian Sulinski
  • 5,815
  • 7
  • 39
  • 61
  • I think the best approach is just to hide it from bots, may be you can use something like this [VueIfBot](https://github.com/Developmint/vue-if-bot) – angel.bonev Oct 01 '19 at 09:38
  • Hmm, interesting - I might give it a try - thanks very much. – Sebastian Sulinski Oct 01 '19 at 09:39
  • I also found some notes on `googleoff` tags - will see if that will do anything as well. – Sebastian Sulinski Oct 01 '19 at 09:40
  • good question - no particular reason - if it can work with other search engines then that's a bonus. – Sebastian Sulinski Oct 01 '19 at 09:53
  • My point is that `googleoff` won't work on bing or any other search engine, if you want to protect your user phone number or something you need to check if the user is a bot. For example if i make my own crawler and i want to get all your users phone numbers what will stop me? Is that the case? – angel.bonev Oct 01 '19 at 10:08
  • That's a valid point - client's brief was to hide it from google, but that's probably only because they use it as their main search engine. I've looked at that Vue package - I might take a few pieces of it and code my own as this one wraps the content in the `div` tag, which is not always desirable - especially with inline links. – Sebastian Sulinski Oct 01 '19 at 10:18

1 Answers1

3

I think the best approach is just to hide it from bots, may be you can use something like this VueIfBot

<vue-if-bot>
<a href="tel: ...">This will not be visible for bots</a>
</vue-if-bot>

or any other alternative just check the userAgent for example in php

function _bot_detected() {

  return (
    isset($_SERVER['HTTP_USER_AGENT'])
    && preg_match('/bot|crawl|slurp|spider|mediapartners/i', $_SERVER['HTTP_USER_AGENT'])
  );
}

If you can't get userAgent, but you still want to check if this is a search engine crawler you can check user IP adress here is a list of IP Addresses of Search Engine Spiders

And finally after you successfully hide your data you can test it with User-Agent Switcher

angel.bonev
  • 2,154
  • 3
  • 20
  • 30