I have put this piece of code together and placed it in the header on my wordpress site. I am using Divi theme. The class gtag-phone is on my CTA.
The problem I am having is that google is not verifying the tag and not reporting any conversions. I am not sure if it is wordpress not accepting the code or if I wrote something wrong?
A second set of eyes would be very appreciated. Thank you!
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-xxxxxxxxxx/xxxxxxxxxx',
'event_callback': callback
});
return false;
}
//Button Conversion Function
jQuery(document).ready(function($){
$('.gtag-phone').on('click', function(e){
gtag_report_conversion($(this).attr('tel:1234567890'));
})
});
</script>```