This is more of a PHP question than specifically WordPress, but you can use PHP’s in_array
to test if $post->ID
is in a bunch of values, like this:
<?php if( in_array($post->ID, [13052, 1234, 4242]) ) { ?>
<!-- Event snippet for thank-you page --><script> gtag('event', 'conversion', {'send_to': 'AW-105871269/5v9gsts6dbdsJ-Kl'});</script>
<?php } ?>