After inserting Google Analytics code in footer.tpl, the footer disapeared

Posted by netfuchs 
After inserting Google Analytics code in footer.tpl, the footer disapeared
December 16, 2013 02:57AM
I inserted the following code in the file footer.tpl of my template.
After that, the whole footer disapeared.
Where ist the mistake?
Thanks for your help.

[code="html4strict"]
<!-- BEGIN TEMPLATE footer.tpl -->
<div id="footer-plug">
This <a href="[www.phorum.org];
is powered by <a href="[www.phorum.org];.

</div>

</div> <!-- end of div id="phorum" -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'XX-XXXXXXXX-X', 'mydomain.tld');
ga('send', 'pageview');

</script>
</body>

</html>
<!-- END TEMPLATE footer.tpl -->
[/code]
Re: After inserting Google Analytics code in footer.tpl, the footer disapeared
March 29, 2014 06:36AM
Same for me.
¿Do you found a solution to that problem?
Re: After inserting Google Analytics code in footer.tpl, the footer disapeared
March 29, 2014 06:45AM
The "{" was the problem. (it was so obviously...)
You need to put your code this way:

[code="javascript"]
<script>
(function(i,s,o,g,r,a,m)
{
i['GoogleAnalyticsObject']=r;i[r]=i[r]||function()
{
(i[r].q=i[r].q||[]).push(arguments)
}
,i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
}
)(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'XX-XXXXXXXX-X', 'mydomain.tld');
ga('send', 'pageview');

</script>
[/code]
Re: After inserting Google Analytics code in footer.tpl, the footer disapeared
July 31, 2014 04:42AM
It works.
Thank you for your help.
Re: After inserting Google Analytics code in footer.tpl, the footer disapeared
June 19, 2015 02:02PM
@ raulramirez

You rock man, this worked like a champ.

Google just gives you the code. It doesn't tell you how to space out the lines. You gave EXTREMELY helpful information and fixed another bug I was having with my forum.

Thanks!!
Sorry, only registered users may post in this forum.

Click here to login