AdWords
5.2K members online now
5.2K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

How to get website call tracking working?

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

I have the following code:

 

    <script type="text/javascript">
    (function(a, e, c, f, g, b, d) {
    var h = {
    ak: "9999999999",
    cl: "rrrrrrrrrrrrrrrrrrr"
    };
    a[c] = a[c] || function() {
    (a[c].q = a[c].q || []).push(arguments)
    };
    a[f] || (a[f] = h.ak);
    b = e.createElement(g);
    b.async = 1;
    b.src="//www.gstatic.com/wcm/loader.js";
    d = e.getElementsByTagName(g)[0];
    d.parentNode.insertBefore(b, d);
    a._googWcmGet = function(b, d, e) {
    a[c](2, b, h, d, null, new Date, e)
    }

    })(window, document, "_googWcmImpl", "_googWcmAk", "script");
    </script>

 

    <script type="text/javascript">
    var replacePhone = function(formatted_number, mobile_number) {
    var elm = document.getElementsByClassName("trackPhone");
    for (var i = 0; i < elm.length; i++) {
    elm[i].href = "tel:" + mobile_number;
    elm[i].innerHTML = "";
    elm[i].appendChild(document.createTextNode(formatted_number));
    }
    var elm = document.getElementsByClassName("replaceThis");
    for (var i = 0; i < elm.length; i++) {
    elm[i].innerHTML = "<p>Tel:<br><a href='tel:" + mobile_number + "' class='number_link'>" +                   formatted_number + "</a></p>";
    }
    };
    </script>

 

    <script type="text/javascript">
    window.onload = _googWcmGet('replacePhone', '0121-111-1111');
    </script>

 

    <p id="navphonenumber"><span>Tel:</span> <a href="tel:01211111111" class='trackPhone'>0121-111-1111</a></p>

 

    <div class="replaceThis">
    <p>Tel:<br><a href="tel:01211111111" class='number_link'>0121-111-1111</a></p>
    <p>Freephone:<br><a href="tel:08001111111" class='number_link'>0800-111-1111</a></p>
    <p>Mobile:<br><a href="tel:07501111111" class='number_link'>07501-111-111</a></p>
    </div>

 

I have tested this code in the Chrome javascript console:

 

    replacePhone('0123-456-7891','01234567891');

 

and everything seems to be working. All numbers and links get changed correctly. However when I test it live the tracking phone numbers never appear.

 

I have contacted google adwords support and they said they are unable to assist me because the problem is with the code. I tried to explain that the code has been tested with the javascript console but they say they are 100% sure the problem is not on their end.

 

Please help!!!! Can anyone suggest what the problem could be? Any help would be really appreciated. I have been trying to get this set up for over a week now :-/

 

 

 

1 Expert replyverified_user

Re: How to get website call tracking working?

Top Contributor
# 2
Top Contributor

Hi,

 

Did you try to call the funtion like:

<body onload="_googWcmGet(replacePhone, '0121-111-1111');">

 

I just made a quick test:

window.onload = replacePhone('0123-456-7891','01234567891'); <- not working

<body onload="replacePhone('0123-456-7891','01234567891');"> <- working

 

Let me know if this works.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: How to get website call tracking working?

H
Visitor ✭ ✭ ✭
# 3
H
Visitor ✭ ✭ ✭
Hi Arnold

Thanks for the reply!

Unfortunately it's still not working. Could I PM you my web address for you to take a look?

Re: How to get website call tracking working?

Top Contributor
# 4
Top Contributor
Hi,

Yes, please PM me the web address, I'd glad to take a look.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital