Jump to content

Google Analytics footer.tpl problem


jrnetwork

Recommended Posts

I'm putting this code right before the </body> tag in the footer.tpl file which is part of the default whmcs issued template called 'portal'.

 

As per the wiki page where it says to put this code below. I've also tried it with the {literal} tags outside the script tags, and tried it like a few others have in other posts on these forums, but my page still breaks. The code seems to work fine i.e. when I browse to a template page and 'view soure' the code is there, but the whole right-hand pane of the portal page then jumps below the main content area... with no other changes being made other than inserting the Google code exactly where it should go.

 

I hope I'm not the only one who this is/has happened to... and that there is a work-around...

 

<script type="text/javascript">

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

{literal} try {

var pageTracker = _gat._getTracker("UA-xxxxx-x");

pageTracker._trackPageview();

} catch(err) {} {/literal}

</script>

 

Here is a screen shot of what is happening.

 

footer-tpl-google-analytics-error.png

Link to comment
Share on other sites

I've put this into my code right before the </body> tag:

 

{php} include("../includes/analyticstracking-whmcs.txt"); {/php}

 

If you view the page here, you'll see it throws the side bar out of whack, placing it below the content in the default portal template.

 

http://www.cubewebsolutions.com.au/support/

 

The analytics coding is actually showing in the source code, so that seems to be correct, it's just the issue above that I can't seem to fix. I don't know why inserting the code where I have should affect the template.

 

Any help would be great, thanks.

Link to comment
Share on other sites

in footer.tpl in the 'portal' template, there is a line of code missing.

 

At the very top of footer.tpl, you'll see:

 

{if $langchange}<div align="right">{$setlanguage}</div><br />{/if}

 

<div id="side_menu">

 

There needs to be another </div> in there which is missing, so it becomes this:

 

{if $langchange}<div align="right">{$setlanguage}</div><br />{/if}

</div>

<div id="side_menu">

 

This only comes to light for those people wanting to put Google Analtics right before the </body> tag of footer.tpl.

 

Thanks to 'Sparky' for solving this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated