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 :)
You should look at the way your partner is adding the new parameter. It should look something like this :
https//www.website.nl/thank-you?ids=5&id=12345Read this for details about Query string structures.
Hi yeah, that's correct. it will add like this: https//www.website.nl/thank-you?ids=5&id=12345 do you know how to get the value from the ids and piush it with the google ads conversion script?
If your url structure is good, then your php code will work properly and extract the data you need. Do you get any error ? Could you share your global site tag config ?
Hi, Yeah this is the url structur https//www.website.nl/thank-you?ids=5&id=12345 And i'm using the script like above... But the values won't appear in Google Ads anymore, since the partner ads their own id at the end
and are you sure your partner ID is_numeric ? Your condition needs the param id to be a numeric value to retrieve you ids value... maybe could you skip the ID param and test ?
Hi with the ids i set a static value the partner will automaticly adds (on the conversion) and id (nummeric) apparently a lead id-number. i've one lead gen form, without integration of the partner (i work with another partner for this), so this thank you page is only with my ids and works (the value will been pushed to Google Ads)