Kirby tag : cell (tel) - "obfuscate" your cell- phone-number

Maybe a bit off-topic and outside the scoop of this forum, but let’s give it a try…


  1. I have a corporate website, and I want to publish my cell-number on that site.
  2. My site-visitors should be able to see that phone-number.
  3. I don’t want Google / Bing to index it (so my number shows up in every, single search-results; I don’t want that).

That’s why I created this solution;

  1. Kirby-text : (email:1234567890 text:call me)
  2. jQuery code 1 : var cell = $(".my-link");
  3. jQuery code 2 : cell.attr("href", cell.attr("href").replace("mailto", "tel"));

The code above does these things;

  1. Write down my number 1234567890 with html-entities.
  2. The mailto link is replaced by a tel link (so when you click it, Skype or your cell is dialing it).

This works perfect, but I still do have one question - regarding this solution;

How does Google / Bing treat (handle) the html-entities, fired by Kirby?

Does Google / Bing still index the “real” number (123456790) or only the entities, or nothing at all?


I don’t care if site-visitors see my number, but I do care when everyone (even those who are not visiting it) can see it (in the universal Google / Bing search results).

The reason why I use this “complex” solution, is because my corporate cell-number is also my private-number. And a lot of semi-illegal marketing-companies find it fun to “spam” my number with “offers I can’t refuse”.

So I want to make it a bit harder for them, to harvest the number in their database.


I also tried to obfuscate the number by javascript, but guess what… both Google and Bing do support javascript - so that didn’t work :slight_smile: (the obfuscated number was still shown in their search-results - that’s why I am trying this new approach).

Please note that your “replace mailto with tel” approach also doesn’t work as search engines execute that JavaScript.
Search engines will also evaluate entities, so that doesn’t help either.

Also please note that you shouldn’t rely on JavaScript for stuff like that. If jQuery can’t load because of network issues, the link won’t work anymore for your real users.

PS: In Germany, calling without caller ID for “marketing” reasons is illegal. Isn’t it the same for you? You could ask your phone service provider to block those calls before they reach your phone. Because no matter how hard you try, they will still get your number. :wink:

Thanks - so “hiding” it in entities doesn’t work (that’s the information I needed to know).

jQuery is parsed / compressed / minifyed in my single JS-assets; so that’s no problem (all local - on the same server).

In my country we do have a “do not call me” register; I added my number “dozens” of times to it - but still automatic call-scripts call my number… everyday, on exactly the same hour(s)…

I want to be reachable for customers, not for search-engines :stuck_out_tongue:

####Final question

When search engines will also evaluate entities, what’s the purpose of the kirby mail tag (where it “converts” an email-adres into entities)?

Search engine will still be able to access it, so do spam-harvest-engines?

Not necessarily. Many will be able to access the data today, but some don’t parse HTML but just search for a string between mailto: and a ".

Cool - it’s an extra layer of “security by obscurity” I guess?

Better safe than sorry :slight_smile:

##Simple fix, to “obfuscate” your cell-number.

I decided to create a simple script, in order to “obfuscate” your cell-number (it’s not 100% safe, but well… maybe it helps a bit).

It’s not quite important, so no plug-in here, just some code for those who are interested. I also wrote it quick, so no thoroughly tested functions here.


/site/tags/cell/cell.php

<?php

// cell tag

kirbytext::$tags['cell'] = array(
  'attr' => array(
    'text',
    'class',
    'title'
  ),
  'html' => function($tag) {

function cellulair($string) {

  $cell = '';
  $i = 0;

  while($i < strlen($string)) {

    $char = $string[$i];

      if(is_numeric($char)) {
        $char += 1;
      } else if ($char == ' ') {
        $char = '0';
      } else {
        $char = $char;
      }

    $cell .= $char;
    $i++;

  }

  return $cell;
}

    $text = $tag->attr('text');
    $cell = cellulair($tag->attr('cell'));

    if(empty($text)) $text = $tag->attr('cell');

    $spacer = empty($tag->attr('class'))?'':' ';

    return html::a($cell, html($cell), array(
      'rel'    => $tag->attr('rel'),
      'class'  => $tag->attr('class') . $spacer . 'cellulair',
      'title'  => html($tag->attr('title'))
    ));
  }
);

?>

/assets/js/cell/cell.js

cell_element = $(".cellulair");

cell_element.each(function(index) {

  cell_index = 0;
  cell_txt = cell_ref = cell_1 = cell_2 = '';

  while(cell_index < cell_element.text().length) {

    cell_tmp = cell_element.text().charAt(cell_index);

    if (!isNaN(1*cell_tmp)) {

      cell_1 = cell_2 = cell_element.text().charAt(cell_index)-1;

        if (cell_1 == -1) {
          cell_1 = ' ';
          cell_2 = '';
        }

    } else {

      cell_1 = cell_2 = cell_tmp;

    }

    cell_txt += '' + cell_1;
    cell_ref += '' + cell_2;
    cell_index++;
  }

  cell_element.text(cell_txt).attr('href', 'tel:' + cell_ref);

});

markdown

Cellulair : (cell: 06 434 32 928 title: Call me!)


###How it works

You enter your number, just like in the markdown above.

Let’s say your number is 06 434 32 928, the php-script will write it down while every number is added by one (so 4 becomes 5 and 7 becomes 8 - spaces will become 0).

Spiders will see the correct number 06 434 32 928 displayed as 17054504301039.

The javascript does the reverse; it subtracts every number by 1. And when a number becomes -1 it will be converted back into a space.

Finally, it attaches the “correct” number as a tel: anchor to it’s wrapper.


- your entry in the backend -

- how the number is displayed in the html-source -

- how visitors will see it (minus the styling) -

Thank you for sharing. However it has the same issue that bots that can run JS will be able to get the real value. Also, it won’t work if the JS code does not run for some reason.

I know - that’s why it’s just a snippet in a forgotten forum-post, not a full-blown plug-in :slight_smile:

Regarding the JS; I don’t care for that… without JS my site doesn’t work the way I want it to work (it’s Bootstrap based), so that’s not an issue in this particular case.

Maybe someone else can use the code and if not… no problem; it was fun creating it (and it suites my needs).

The best way I have found to get rid of these spam callers is to ask them for their details. They usually immediately put down the phone on you and never call you again.

3 Likes

In my country, there are 2 or 3 really aggressive caller-companies;

They don’t call by hand, but have computers / bots who call you. Even when you pick up the phone, they don’t answer; they just want to know if your number is “active”.

So I block all known spam-numbers and anonymous-callers (using True Caller, the app).

But even then, they spam me (and other) by entries of the Chamber of Commerce…

So I don’t want to publish my mail and number on the site in a easy way.

I know javascript / obfuscating is not 100% solid, but it’s a “cat and mouse” game… hopefully I am the cat here :stuck_out_tongue:


BTW. I love Tom and Jerry !

Yeah, that’s true, we have them here in Germany as well. Fortunately, I only had very few of those up till now.

My worst experience ever was when I cancelled a Vodafone subscription a couple of years ago. They called me a dozen times or more a day. It did not help to ask them to not call me again. It did not help to not answer the phone. Until the day I was so fed up, I got hold of the email address of one of their bosses and sent him an email whenever they called me. It did not take long before his assistant called me and was all sorry. Luckily, I got out of the contract two months earlier this way. They never called me again, either.

I tried to use your service, but my phone doesn’t support it :frowning: The only opportunity to use it - is android emulator software

I can’t speak for every cell - but it’s working on my test devices (Windows Mobile / Windows Phone / Android Phone).

But it also depends on your used browser, I guess…

The tel: hyperlink is universal, not Kirby related 'though.