jQuery button click not activating floodlight counter

95 views Asked by At

I have created this button to send conversions when clicked, however the conversion is sent when the page is loaded, is there a way to only send the conversions when the button is clicked.

img of code

<head>
<body>
<a ondblclick="btngreen()" href="https://info.tcs.com/rs/744-FUI-742/images/IT%20Operating%20Model%20Transformation%20v4.0.pdf">Send Conversion</a>

<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://9607796.fls.doubleclick.net/activityi;src=9607796;type=tcser0;cat=tcsdo0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
document.querySelector('[href*=https://info.tcs.com/rs/744-FUI-742/images/IT%20Operating%20Model%20Transformation%20v4.0.pdf]').addEventListener("click", function btngreen(){
        gtag('event', 'conversion', {
            'allow_custom_scripts': true,
            'send_to': 'DC-9607796/tcser0/tcsdo0+standard'
        });
    });
</script>
<noscript>
<iframe src="https://9607796.fls.doubleclick.net/activityi;src=9607796;type=tcser0;cat=tcsdo0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</body>
</head>

0

There are 0 answers