Implementing Google Ads Call Tracking Conversion

Tealium Expert
Tealium Expert

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

 

Research your Experience | Improve and Evolve | Leave no one behind
2 REPLIES 2

Implementing Google Ads Call Tracking Conversion

Tealium Expert
Tealium Expert

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.

Highlighted

Implementing Google Ads Call Tracking Conversion

vinayreddy
Silver Contributor
Silver Contributor vinayreddy

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.

VR