wilsonf1 Posted August 16, 2011 Share Posted August 16, 2011 HeyI have a mobile version of my website and on one page I display a telephone number. When people click this number on their mobile phone device, it loads the number into the "make call" application. Pretty simple thing built into most mobile devices.I thought of adding an onclick event to the number to track this in google analytics - but when ever I try either onclick, or a jquery bind/click, it does track, but the number doesn't load in the call application on mobiles any more.It's like the javascript is overriding the default event - which is obviously no good!I've tried things like return TrackFunction() and tried return false and true but to no availCan anyone suggest something else to try to stop the 2 things from conflicting?Cheers Link to comment Share on other sites More sharing options...
thescientist Posted August 16, 2011 Share Posted August 16, 2011 you should post the code, but are you also returning true/false from your function too?i.e. TrackFunction(){ . . return true;};..<a href="return TrackFunction()">Click</a> Link to comment Share on other sites More sharing options...
wilsonf1 Posted August 16, 2011 Author Share Posted August 16, 2011 you should post the code, but are you also returning true/false from your function too?i.e.<p style="text-align:center" class="phone-number" onclick="java script:return trackNum();">0800 000 123</p> function trackNum() { _gaq.push(['_trackPageview', '/number-click/this-page/mobile']); return true; } Link to comment Share on other sites More sharing options...
thescientist Posted August 17, 2011 Share Posted August 17, 2011 can you check for errors in the mobile web browser? Link to comment Share on other sites More sharing options...
wilsonf1 Posted August 17, 2011 Author Share Posted August 17, 2011 can you check for errors in the mobile web browser?Hmm no i cant, its the default htc one. I can obviously check the mobile version in a pc browser though. When i click the number i see in the status bar the call to google analytics - so my function is all goodIts just seems to interefer with the default behavior of clicking a number on a mobile Link to comment Share on other sites More sharing options...
wilsonf1 Posted August 18, 2011 Author Share Posted August 18, 2011 can you check for errors in the mobile web browser?]Found a new solution, didn't realise there was such things as href="tel:" links! Works perfectly fine on mobile versions and the javascript works at the same time Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.