Reply
Highlighted
Visitor
Posts: 27
Registered: ‎09-18-2017

Implementing Google Ads Call Tracking Conversion

Hi All

So i am looking at implemeting the google ads call tracking, which is not native to the current conversion adn remarketing tag. 

The code for this uses a call back function to fetch on a gtag api call, which receives a forwarding number then uses an element id to replace the number on site. 

<script type="text/javascript">
    var callback = function(formatted_number, mobile_number) {
      // formatted_number: number to display, in the same format as
      //        'phone_conversion_number'.
      //        (in this case, '1-800-123-4567')
      // mobile_number: number formatted for use in a clickable link
      //        with tel:-URI (in this case, '+18001234567')
      var e = document.getElementById("number");
      e.innerHTML = "";
      e.appendChild(document.createTextNode(formatted_number));
    };

    gtag('config', 'AW-CONVERSION_ID/CONVERSION_LABEL', {
      'phone_conversion_number': '1-800-123-4567',
      'phone_conversion_callback': callback
    });
  </script>

Besides a DOM insjection (which i suspect won't work, due to the global tag potentially not having been called). Are there any other ideas as to the best way to do this?

thanks


Gavin

 

Reply
0 Kudos
Contributor
Posts: 72
Registered: ‎04-20-2016

Re: Implementing Google Ads Call Tracking Conversion

Hi @GavinAttard

That should work fine if you put that code in a JS extension scoped to either After Tags or DOM Ready.

That scoping should ensure the gtag code is available.

Checkout our blog: www.120feet.com/blog
Reply
0 Kudos
Visitor
Posts: 16
Registered: ‎04-02-2018

Re: Implementing Google Ads Call Tracking Conversion

Hi @GavinAttard,

You can add a Tealium custom container tag. In the tag template place the exact code where it says "start tag sendind code" and publish. Then You are all set.

Reply
0 Kudos