Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Oct 2007
    Posts
    11
    Plugin Contributions
    0

    help question Where to install Google Analytics code?

    I want to track some stuff on my zen cart using google analytics. It says to put it right before the /body .... but my question is, where? The main style sheet, so it will be everywhere? I want to go into every page, will that have to be done manually? HELP

  2. #2
    Join Date
    Jul 2006
    Location
    SF Bay Area
    Posts
    867
    Plugin Contributions
    1

    Default Re: Where to install Google Analytics code?

    the file is:

    /includes/templates/YOUR-TEMPLATE/common/tpl_main_page.php

    replace YOUR-TEMPLATE with the name of the template you are using.

    And you did the MySQL patch too right?

  3. #3
    Join Date
    Oct 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    the mySLQ patch? Yikes, I don't even know what that is. Someone else set up my site for me....

  4. #4
    Join Date
    Jul 2006
    Location
    SF Bay Area
    Posts
    867
    Plugin Contributions
    1

    Default Re: Where to install Google Analytics code?

    Let me ask...

    Are you using the Google Analytics module from the downloads section?
    Or are you just trying to install the script snippet you get from the Google Analytics page?

  5. #5
    Join Date
    Oct 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    I'm installing the script snippet from the google site.

  6. #6
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: Where to install Google Analytics code?

    Quote Originally Posted by artwerx View Post
    I'm installing the script snippet from the google site.
    In that case edit includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php (you might have to copy it there first from template_default) and right before the </body> tag add the following...
    PHP Code:
    <?php
    if ($request_type == 'NONSSL') {
        
    $google_analytics_url "http://www.google-analytics.com/urchin.js";
    } else {
        
    $google_analytics_url "https://ssl.google-analytics.com/urchin.js";
    }
      echo 
    '<script src="' $google_analytics_url '" type="text/javascript">'."\n";
    ?>
    </script>
    <script type="text/javascript">
    _uacct = "UA-XXXXXXX-X";
    urchinTracker();
    </script>
    ...replace the UA-XXXXXXX-X bit with your own number that is given to you in the code snippet on the Google Analytics site.

    Regards,
    Christian.

  7. #7
    Join Date
    Mar 2007
    Location
    USA
    Posts
    4
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    After copying that above code into the file specified, and using my google analytics account number (which is a valid google analytics account, ....I get the following parse error code. Am I doing something wrong?

    Parse error: syntax error, unexpected '{' in /home/mysitename/public_html/includes/templates/template_default/common/tpl_main_page.php on line 1

  8. #8
    Join Date
    Nov 2007
    Posts
    6
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    I'm trying to do the same thing, and I got the same error message...!!!

    GRRRrr

  9. #9
    Join Date
    Nov 2007
    Posts
    6
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    I got it I moved the code down to line 357 right before the </body? statement line.

    It works for me and google picked it up...


    Lots of joy here!


  10. #10
    Join Date
    May 2008
    Location
    Mount Colah, NSW, Australia
    Posts
    48
    Plugin Contributions
    0

    Default Re: Where to install Google Analytics code?

    Quote Originally Posted by CJPinder View Post
    In that case edit includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php (you might have to copy it there first from template_default) and right before the </body> tag add the following...
    PHP Code:
    <?php
    if ($request_type == 'NONSSL') {
        
    $google_analytics_url "http://www.google-analytics.com/urchin.js";
    } else {
        
    $google_analytics_url "https://ssl.google-analytics.com/urchin.js";
    }
      echo 
    '<script src="' $google_analytics_url '" type="text/javascript">'."\n";
    ?>
    </script>
    <script type="text/javascript">
    _uacct = "UA-XXXXXXX-X";
    urchinTracker();
    </script>
    ...replace the UA-XXXXXXX-X bit with your own number that is given to you in the code snippet on the Google Analytics site.

    Regards,
    Christian.

    Thanks for this tip. It worked for me too! Finally I get something right with no problems.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Where to put google analytics tracking code???
    By cmike in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 23 Apr 2014, 08:05 AM
  2. Where can I put some Google Analytics code?
    By Solarpitch in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Dec 2008, 03:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg