title: Use a PHP script to execute a JS <script> tag on the homepage only
body: <p>I am trying to create a statement in PHP that will make a survey monkey popup appear on the homepage of a website and not on the other pages.</p>
  
  <p>I've tried the below code and different variations of it to try and get it to work. I can add the popup to the entire site by just putting the  element into the  of the website but when I try to get it to appear only on the homepage, nothing shows up at all.</p>
  
  <p>I've tried it using just one 'echo' instead of splitting it into three and also using /index.php instead of /.</p>
  
  <pre><code>&lt;?php
  if ($_SERVER["SCRIPT_NAME"] == '/') { 
    echo '&lt;script&gt;';
    echo '(function(t,e,s,o){var n,a,c;t.SMCX=t.SMCX||[],e.getElementById(o)||(n=e.getElementsByTagName(s),a=n[n.length-1],c=e.createElement(s),c.type="text/javascript",c.async=!0,c.id=o,c.src=["https:"===location.protocol?"https://":"http://","widget.surveymonkey.com/collect/website/js/tRaiETqnLgj758hTBazgd_2Fw5nxAtNDAAqLsYqzVv_2FShi5yryjY3psD6EYInvUCYX.js"].join(""),a.parentNode.insertBefore(c,a))})(window,document,"script","smcx-sdk");';
    echo '&lt;/script&gt;';
   }
  
  ?&gt;
  </code></pre>
  
  <p>I have found some similar questions on here but none that quite fit my situation, I've also tried out some of their answers recommendation but they don't seem to work. </p>
  
  <p>Any help would be greatly appreciated, I feel like it's something so simple and I'm just complicating matters. Hopefully I've provided enough information for you all!</p>