Display Script in Header When URL Variable Present

I have a script that I want to display in the wp_head, but only if a URL variable is passed. For example, if someone visits https://example.com/?feedback=yes I want the following script to display:

  <script>     alert( 'Hello, world!' );   </script> 

I can already have this display all the time via the following function, but it’s the part around having it only display if that URL variable exists that I’m not sure on.

/* Describe what the code snippet does so you can remember later on */ add_action('wp_head', 'your_function_name'); function your_function_name(){ ?>   <script>     alert( 'Hello, world!' );   </script> <?php };