Echo Database Content for Google Analytics
I have a field in my database where I paste the Google Analytics Code. The code is displaying weird.
Here is the database request: <?php echo($rsSiteInfo->getColumnVal("siteGoogleAnalytics")); ?>
Here is the google code:
<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-107648533-1"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-107648533-1'); </script>
Here is what is showing up:
&lt;!-- Global site tag (gtag.js) - Google Analytics --&gt;&lt;script async src=&quot;https:&#x2F;&#x2F;www.googletagmanager.com&#x2F;gtag&#x2F;js?id=UA-107648533-1&quot;&gt;&lt;&#x2F;script&gt;&lt;script&gt; window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(&#x27;js&#x27;, new Date()); gtag(&#x27;config&#x27;, &#x27;UA-107648533-1&#x27;); &lt;&#x2F;script&gt;
-----------------
I tried echoing using: <?php echo html_entity_decode($rsSiteInfo->getColumnVal("siteGoogleAnalytics")); ?>
It still doesn't work but it's closer:
<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-107648533-1"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-107648533-1'); </script>