Google Analytics simple question

Discussion in 'TemplateCodes' started by ebee, Aug 8, 2011.

  1. ebee Customer

    I am trying to add tracking code to my site. I am using sigma templates. Could some one pls let me know which "template page" or pages I need to modify when google advised as follows: (also see screenshot). I have created a analyticstracking.php file and uploaded to root of my web. Now just need to amend the template files but not sure which ones!

    Paste this code on your site
    Copy the following code, then paste it onto every page you want to track immediately before the closing </head> tag.
    For any PHP pages, put the following code in a file (for example, analyticstracking.php) and upload it to your site. Then, add the following line to each template page immediately after the opening <body> tag: <?php include_once("analyticstracking.php") ?>


    [IMG]
  2. Mike-N-Tosh Owner

    This code should go into the layout.tpl template page as that is the overall (shell) template page which all other template files are placed within.

    When adding javascript to a template file you should also follow the smarty rules and place it between:
    {literal}
    ... your javascript code here ...
    {/literal}
  3. ebee Customer

    Thank you for the help!!

    Thanks for that - I have added that to my website as you suggested.
  4. volponerosso New Member

    I do not work .. I followed the directions, the 'I put both inside <head> and I tried but does not work in <body>
  5. freeze2 Super Moderator

    Follow Mike's instructions above and it will definetely work...the latest Google code says placement should be just before the closing </head> tag.

    If you can share a link, we may be able to see what's wrong...thanks
  6. volponerosso New Member

    this is my code in layout.tpl and the site is www.mercatinoracing.it

    thanks :)


    Code:
    another code.......
     
    {/literal}
        {$header}
        {modulehook function="tpl_layout_head" options=""}
     
     
    <!--inizio analitic-->
    {literal}
    <script type="text/javascript">
     
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-********']);
      _gaq.push(['_trackPageview']);
     
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
     
    </script>{/literal}
    <!--fine analitic-->
     
     
     
    </head>
  7. freeze2 Super Moderator

    I took a look at your source code and the Google Analytics code is not there. Have you uploaded your updated layout.tpl file?
  8. volponerosso New Member

  9. freeze2 Super Moderator

    I see you have it up and running, what did you find to be the problem?
  10. volponerosso New Member

    i find the problem: i delete the code for comment html <---> and it function ;)

Share This Page