Tracking phone calls generated from your website is an important metric. How else will you learn how effective your ads are in leading to phone calls from your website that ultimately lead to conversions? Granted, not every call that comes from a website is the result of an ad. Many calls are organic, meaning they've been driven by the site itself and the content you publish. Regardless of the vehicles that lead to a phone call, it's still nice to know how many of those calls result from a click through on your website.
With the addition of Google AdWords Call tracking to your site, you can track calls that originate from your site or mobile devices. The instructions for adding the Google AdWords tracking code to your site are pretty straightforward. Straightforward, that is, if you have a plain vanilla, generic type of website. If you are using a professional developers' tool like the Genesis Framework, Google's instructions may not apply to you. We've written this article to help you install the Google AdWords call tracking code into your Genesis based child theme.
First Method—Don't Try This at Home
One way of attempting to add the code is with the genesis_attr_body filter:
As simple as it is, the problem with the above code is that it doesn't work. When passed through the filter, it does indeed add the AdWords function to the <body> tag. However, it also sanitizes the code and converts the required single quotes within the function into their respective HTML entities (&039). So the resulting HTML looks like this:
It's not very pretty. It definitely won't work. And we haven't been able to find a work-around.
Third Time's the Charm
The third method, and the one that we prefer, is to add the code directly to header.php. Genesis child themes typically do not have a custom header.php. Header.php is found in the Genesis directory. Since this is core code, you must not under any circumstances edit this file directly. Doing so will create a multitude of problems for you when the Genesis Framework is updated. You can, however, copy header.php into the root folder of your child theme and then edit that file. The code below is an edited header.php from Genesis Version 2.2.3 that you can copy and paste into the child theme directory. Lines 21 and 22 show the modifications. Change the number to your own.