tracking click-to-call mobile feature
I have a simple wordpress/php landing page with a click-to-call link:
<a href="tel:888-555-7777" target="_self">888-555-7777</a>
When that link is clicked on a mobile phone, a dialog box opens and asks the开发者_开发技巧 user if she want to make the call. Clicking "yes" dials the number.
My question is two folds:
- How can I track the number of users who clicked on that link?
- How can I track the number of users who clicked "yes" on the dialog box.
number 1 is of higher priority to me than number 2.
Thanks in advance.
If you use the async Google Analytics code on your website, the following JavaScript should help with the first part of your question. Code sample requires jQuery.
// Select the links that start with "tel" in their href
$("a[href^=tel]").each(function(){
$(this).click(function(e){
// Use Google Analytics to track this click
_gaq.push([ '_trackEvent', 'Telephone Link', 'click', this.href ]);
});
});
I'm not sure if the second part is traceable though.
- just add a onclick event handler. Use ajax to send the click-info to the server.
- you can probably detect if the user clicked 'no'. Set a timeout of about 2 seconds. If the event fires the user is still on the page, so it must have clicked 'no'. This should work on iPhone, not sure about android,blackberry,etc. Maybe you also have to store the time of click, just in case the timeout fires once the user returns to the page after the call.
Another simple way to have your stats would be using your own VoIP server. So you could see all calls in the VoIP statistics.
精彩评论