Thursday, August 21, 2014

How to apply HTML Code Google AdWords Website Call Conversions

 

You need to add a div, span or any other html tag on your pages where you want to show this Google’s auto generated phone no.  This html tag must have an Id or Class name.

See example:  if you are using class name of div or span.
Step 1.  Add Google code within java scripting tag before </head> tag.
<script type="text/javascript">
Paste Google code as it is.Please do not change anything…..
</script>
Step 2.  Add Html Tag like below.

 <body>
  <div class="spanclass">+91-9800-5501-00</div>
</body>

Step 3.  Call _googWcmGet funtion onlaod event of html body tag like

<body onload="applytrackcalls()" >
  <div class="spanclass">+91-9800-5501-00</div>
</body>

Step 4:
Add another java script to declare applytrackcalls() function:
<script type="text/javascript">
  function checkCookie() {

    _googWcmGet(callback, '91-9800-5501-00);
 }
 </script>


See example:  if you are using Id of div or span.
Step 1.  Add Google code within java scripting  tag before </head> tag.
<script type="text/javascript">
Paste Google code as it is.Please do not change anything…..
</script>
Step 2.  Add Html Tag like below.

 <body>
  <div id="spanclass">+91-9800-5501-00</div>
</body>

Step 3.  Call _googWcmGet funtion onlaod event of html body tag like

<body onload="applytrackcalls()" >
  <div id ="spanclass">+91-9800-5501-00</div>
</body>

Stap 4:
Add another java script to declare applytrackcalls() function:
<script type="text/javascript">
  function checkCookie() {

    _googWcmGet(callback, '91-9800-5501-00);
 }

// You need to create another function if you are using Id in tag of div or span and just pass this // id in document.getElementById function.Like I have done

var callback = function(formatted_number, unformatted_number) {
           
            var e = document.getElementById("spanclass");
            e.innerHTML = ""
            e.appendChild(document.createTextNode(formatted_number));
        };

 </script>

Note : If this is still not working the you can debug the error by using try catch method  on _
googWcmGet function Like:
 try
{
    _googWcmGet(callback, '91-9800-5501-00);
 }
Catch(e){
Alert (“Error on Implementing Google code : ” + e);

}



Devendra Kumar
Sr. Web Developer
Apextierteechnologies.com

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. great article!

    I'd like to add the call conversion code to the client's site so it will switch numbers. But I'd like to do this using Google Tag Manager (GTM). I'm very familiar with GTM and have used other call tracking providers. They simply have some html code that I create a custom html tag in GTM and it works fine.

    Can you guys help me to figure out how to add the new call conversion code using GTM? Need to know specifically, what tag to use, what code to add to the tag and the firing rules or macros.

    Thanks!

    -Chris

    ReplyDelete