close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Echo Database Content for Google Analytics

Thread began 9/14/2020 1:31 pm by BillHobbs | Last modified 9/14/2020 3:23 pm by Ray Borduin | 269 views | 2 replies |

BillHobbs

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:
&amp;lt;!-- Global site tag (gtag.js) - Google Analytics --&amp;gt;&amp;lt;script async src=&amp;quot;https:&amp;#x2F;&amp;#x2F;www.googletagmanager.com&amp;#x2F;gtag&amp;#x2F;js?id=UA-107648533-1&amp;quot;&amp;gt;&amp;lt;&amp;#x2F;script&amp;gt;&amp;lt;script&amp;gt; window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(&amp;#x27;js&amp;#x27;, new Date()); gtag(&amp;#x27;config&amp;#x27;, &amp;#x27;UA-107648533-1&amp;#x27;); &amp;lt;&amp;#x2F;script&amp;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(&#x27;js&#x27;, new Date()); gtag(&#x27;config&#x27;, &#x27;UA-107648533-1&#x27;); </script>

Sign in to reply to this post

Ray BorduinWebAssist

Use:

php:
<?php echo($rsSiteInfo->getColumnVal("siteGoogleAnalytics",false)); ?>



That will disable the cross site scripting protection that prevents saved database code from running on your page.

Sign in to reply to this post
Did this help? Tips are appreciated...

BillHobbs

That worked. Thanks.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...