title: Inject hotjar script into angular page inside head element
body: <p>I want to add conditions to load this script in the head tag. I need to check if the URL is from our live domain then only it runs otherwise not. I could simply add this script to the head if there was no condition requirement. How I can inject this script in the head tag in angular?</p>
  <p>For eg:</p>
  <p><code>window.origin == 'https://www.stackoverflow.com'</code> then inject this script into the head tag otherwise not.</p>
  <pre><code>&lt;script&gt;
          (function(h,o,t,j,a,r){
              h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
              h._hjSettings={hjid:*******,hjsv:*};
              a=o.getElementsByTagName('head')[0];
              r=o.createElement('script');r.async=1;
              r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
              a.appendChild(r);
          })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
      &lt;/script&gt;
  </code></pre>