AdWords
5.2K members online now
5.2K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Conversion code and php website code help

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We have been wanting to implement conversion tracking for our Adwords campaign, when someone clicks on a picture of our phone number, it has a tel: command (for mobile and desktops that use Skype) and we would like to be able to track the conversions of people that click the phone number.

The code is as follows to display the picture/phone number.

There's also a separate file labeled phone.class in a class folder, and the only code that is in there is:

<?php

/**
* This class generates the phone numbers on the
* headers and footers.
*/

class Phone{

/* Use this function if there are multiple phone numbers */
public static function number($title){
if($title == "water-heater"){
return ("123-456-7890"); // Enter the number you want if you land on this page
}else{
return ("123-456-7890"); // Enter the number if it is not "water-heater"
}
}

/* Use this function if there is only a single phone number */
public static function number_single(){
return "585-267-5097";
}


Then the code that displays the image is in a folder called 'include' and the file is labeled 'header.inc.php':

<div class="col-xs-12 col-sm-6" id="right-header">
<div class="contact_us">
<p class="title">CALL <a href="tel:<?php echo Phone::number_single() ; ?>"><?php echo Phone::number_single() ; ?></a></p>
<p class="sub-title">
<b>Local and Trusted HVAC Experts</b>
</p>
</div>


I know this last bit of code needs the tags, I'm not not sure how to implement the tags needed for onClick to fire. But again, I just need help implementing the onClick tags into the php tel: command.

Thanks

1 Expert replyverified_user

Re: Conversion code and php website code help

Top Contributor
# 2
Top Contributor

Hi Matt,

You track it the same way you would call any function on an onclick event. I covered this in-depth here. As you've already experienced, it's not easy to paste code into this forum so I'm breaking the rules a little by linking out. My solution involves using GTM in the first case and just plain old JavaScript in the second further down. I'd highly recommend the GTM method as it scales much better.

 

Let me know if you're still having issues figuring it out.