functions – Display Script in Header When URL Variable Present

Question

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>
</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 */