Checking how many times the TEL link is clicked

<a href="tel:010-9401-7765">010-9401-7765</a>

I have the code above at http://dot.kr/x-test/tel/index.php

if a visitor of the page clicks the link with his/her mobile phone, it will call him/her.

I can count the page views of the page by some code like the below.

[code]SELECT count FROM pageView;

$sql=mysql_query($query);
$row=mysql_fetch_assoc($sql);
$count= $row[‘count’];
$newCount=$count+1;

UPDATE pageView
SET count=$newCount[/code]So far so good

Not only I count the pageView, but I like to also count how many times the phone is called.
Can I count it with your help?

I don’t see that snippet working. It is a mix of PHP and MySQL for a start, and why use a database for a simple page count? A humble text file would do the same job.

As far as checking the number of times a link is pressed, you can’t do that in PHP. It may be possible using JavaScript. I can move your post to the JS forum if you would like.

And why are you still using mysql? It is obsolete and should no longer be used.

It’s not something I have ever attempted with a tel link (I have done with downloads), but maybe it’s possible to have a link with some variable that runs a script to record the click and forward you to the destination. Of course being php it would require a refresh, so js may be a slicker option, but reliant of js being active. If you are to use js, I’m sure all this can be done with Analytics without reinventing the wheel.

[quote=“gandalf458, post:2, topic:279339”]
I don’t see that snippet working. It is a mix of PHP and MySQL for a start, and why use a database for a simple page count? A humble text file would do the same job.
[/quote]I like to see the humble text file.

[quote=“gandalf458, post:2, topic:279339”]
As far as checking the number of times a link is pressed, you can’t do that in PHP. It may be possible using JavaScript. I can move your post to the JS forum if you would like.
[/quote]I appreciate your moving this post to JS forum.

Why not use an analytics package, such as Google Analytics? It’s easy to set up and more reliable/feature rich than anything you might roll yourself.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.