Add value from string to Google Ads as conversion value issue
On my website i generate leads via iframe forms. Based on the 'thank you page' i add an value to the url string like:
https//www.website.nl/thank-you?ids=5
the ids value of 5 is the value from the lead conversion (let's say $5,-)
with this script i push the value to Google Ads.
<?php if ( is_page(123) ) { if (isset($_GET["ids"]) && (is_numeric($_GET["ids"])) ) { $value = (float)str_replace(",",".",$_GET["ids"]); $value = sprintf("%01.2f", $value); }else{ $value = sprintf("%01.2f", 0); } echo '<script> gtag("event", "conversion", { "send_to": "AW-*****", "value": '. $value .', "currency": "EUR" }); </script>'; }?>
The above code worked great until my partner added automaticly a lead ID on the end of the url. now the thank-you url is e.g. https//www.website.nl/thank-you?ids=5&id=12345
Now my script won't work anymore... how to fix? any ideas? probably i can't add my ids to the end of the url, because i need to fill in the thank-you url in the iframe static.
hope anyone can help me out to measure conversion values again and send them over to Google Ads :)