Onclick conversion tracking for call button

Hello Everyone,

Sorry if this was already asked but I couldn’t get it to work. I have set up a telephone number call button on my website and I want to track conversions of each click for adwords purposes. I can’t seem to make it work because the conversion tracker tells me it is not connected. Can someone please tell me what do I have to do on my website designer to add the onclick custom code to the button and link it to the conversion tracker?

Thanks so much.

Maybe this will help you → LINK

But because you cant use onclick in Webflow so easy you should use:
(COSTUM CODE AREA)

document.getElementById("YOURID").onclick = function(){
onclick="ga('send', 'event', 'Phone Call Tracking', 'Click to Call', '888-380-2260', 0);"
}

Thanks I’ll take a look at this right away!

Ok so this code you gave me should be put in the head section of the custom code of the page that contains the phone number?

Thank you again!

You can use the Head or the Footer section for that :wink:

And give your phone number a ID… So give your LinkBox around the phone number a unique ID…

So I put this with my ID=botontelefono

<a href=document.getElementById(“botontelefono”).onclick = function(){
onclick=“goog_report_conversion(‘tel:+541143934015’);”
}>

It is not a GA tracker but adwords (maybe not the same?) and google gave me this example:

<button onclick="goog_report_conversion('tel:800-123-4567')">Call 800-123-4567</button>

This should work?

A thousand thanks

    <script>    
       document.getElementById(“botontelefono”).onclick = function()
       {
             goog_report_conversion(‘tel:+541143934015’);
        }
    </script>    

Thats the code :wink: No a href :wink:

And your button/link/number should have the ID “botontelefono” :wink:

Thank you for everything @Matzinger!

Hello again,

Actually this didn’t worked, idk why…

has someone already set up conversion tracking for a telephone number linked button? (conversion tracking for AdWords)

This would really help me.

Thank you!

Can you share your read-only link to your project?

Yes!

https://preview.webflow.com/preview/armandoorellano?utm_medium=preview_link&utm_source=dashboard&utm_content=armandoorellano&preview=e1d8e726d27797ba1effc949367f9554&mode=preview

Here it is.

This is a great article on the topic: Track clicks on your website as conversions - Google Ads Help

In short, follow Step 1 and get your Event Snippet - this will be some JS that you’ll add to your page’s head.

Once you have it, add it to your page’s head like so (substituting the below code with your own custom snippet):

<script>
function gtag_report_conversion(url) {
  var callback = function () {
    if (typeof(url) != 'undefined') {
      window.location = url;
    }
  };
  gtag('event', 'conversion', {
      'send_to': 'AW-CONVERSION_ID/CONVERSION_LABEL',
      'value': 1.0,
      'currency': 'USD',
      'event_callback': callback
  });
return false;
}
</script>

On Step 2, where it asks you to add an onclick attribute to the button, you could normally do this with custom attributes, but certain attributes are reserved, so here’s a Javascript snippet that will add the onclick attribute to your button on page load.

<script>

    var Webflow = Webflow || [];
    Webflow.push(function () {
        document.getElementById('botontelefono').setAttribute('onclick', '\"return gtag_report_conversion(\'tel:+541143934015\')\"');
    });

</script>

Then, you should be done and ready to test it. I would read that guide in more detail to ensure you’re testing correctly and that all is set up properly, but this should work. (Though I should note – I haven’t tested this yet.)

Hope that helps!

Thank you very much I’ll take a look at all of this and I’ll tell you.
Thanks!

1 Like

Hello, just to inform that I tried this last thing you told me @mattvaru but itd didn’t worked out.
AdWords didnt recognize there vas a button in my page so it didnt link the conversion.

However i embeded a button and styled it and it worked so I think this is a good solution.

Thanks for the help everyone!

1 Like