Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2012
    Posts
    30
    Plugin Contributions
    0

    Default Google Analytic s Question

    It says Im supposed to paste this script on the home page and others for tracking and results.
    Can I paste this is the html through ez pages? If not where? Do I need to pull up the php files and insert
    it there? Im a bit confused on this, should not be difficult I know.

    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-37469995-1']);
    _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>

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Google Analytic s Question

    You'll get far better analytics results if you use the Plugin from the Plugins library.

    But if you really want to just paste that stuff into your site and get only the very basic data, paste it into a new file which you upload to:
    /includes/templates/NAME_OF_YOUR_ACTIVE_TEMPLATE/jscript/jscript_mygoogleanalytics.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2012
    Posts
    30
    Plugin Contributions
    0

    Default Re: Google Analytic s Question

    Where is the plugins library? Is that process straight forward?

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Google Analytic s Question

    How "straight forward" is "straight forward" ?

    ... depends on your understanding of web-mastership.

    If you are a competent webmaster, then the process is straight-forward.

    If you are not a competent webmaster, the process can be frustratingly complex.

    This plugin is quite detailed, so you need to be diligent when installing it.

    There is a link above called PLUGINS...

    Look for SIMPLE GOOGLE ANALYTICS for ZC 1.5

    or click this link: http://www.zen-cart.com/downloads.php?do=file&id=272
    20 years a Zencart User

  5. #5

    Default Re: Google Analytic s Question

    find your template footer page -- includes/templates/your-template/common/tpl_footer.php

    you can paste it there somewhere . That is how mine is setup.

  6. #6
    Join Date
    Jun 2012
    Posts
    30
    Plugin Contributions
    0

    Default Re: Google Analytic s Question

    Thank you.

    Paste in the main body section?

  7. #7
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Google Analytic s Question

    Quote Originally Posted by PortFJ62 View Post
    Thank you.

    Paste in the main body section?
    Better, actually, to paste it into tpl_main_page.php, because that file has the closing </body> tag.

    Here are the last few lines of code of the CORE FILE.

    PHP Code:
    <!--bof- banner #6 display -->
    <?php
      
    if (SHOW_BANNERS_GROUP_SET6 != '' && $banner zen_banner_exists('dynamic'SHOW_BANNERS_GROUP_SET6)) {
        if (
    $banner->RecordCount() > 0) {
    ?>
    <div id="bannerSix" class="banners"><?php echo zen_display_banner('static'$banner); ?></div>
    <?php
        
    }
      }
    ?>
    <!--eof- banner #6 display -->
    </body>
    The Google code goes just above the </body> tag.

    <!--eof- banner #6 display -->
    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-37469995-1']);
    _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>

    </body>

    This is the "clunky" way to do things. It is BETTER (if you can) to use the plugin and the reason for this is that you can set various tracking parameters via the admin panel.

    For example, later on you may want to build in some custom tracking code, or assimilate AdWords Tracking with Analytics. The plugin allows you to administer these sorts of things more easily than you would by hard-coding the google scripts.

    But for now, if your analytics needs are simple, then do as I indicate above.

    BEAR IN MIND that tpl_main_page is a CORE FILE. You will need to create an edited OVER-RIDE and place this edited copy into your custom template's COMMON folder.

    EG:

    CORE FILE: /includes/templates/template_default/common/tpl_main_page.php
    OVERRIDE FILE: /includes/templates/YOUR_TEMPLATE_FOLDER/common/tpl_main_page.php
    20 years a Zencart User

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Google Analytic s Question

    Quote Originally Posted by schoolboy View Post
    BEAR IN MIND that tpl_main_page is a CORE FILE.
    And so is tpl_footer.php as suggested by someone else.

    That's why I suggested putting it in a completely separate self-contained jscript_.....php file so that nothing else needs messing with. The only downside is that it will load at the top of the page instead of the bottom. Not much of an issue, but some purists will say it makes their skin crawl to do that.


    So, as you can see, there are many ways to do it. Pick whichever you like.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Google Analytic s Question

    Quote Originally Posted by DrByte View Post
    That's why I suggested putting it in a completely separate self-contained jscript_.....php file so that nothing else needs messing with. The only downside is that it will load at the top of the page instead of the bottom. Not much of an issue, but some purists will say it makes their skin crawl to do that.
    With Analytics using asynchronous loading (text/javascript'; ga.async = true;)it should not matter whether it's in the header, or at the end of the </body> section.
    20 years a Zencart User

 

 

Similar Threads

  1. v139h Woopra analytic tracking identigy code in zencart website
    By snk060 in forum General Questions
    Replies: 4
    Last Post: 16 Jan 2014, 02:47 PM
  2. How do I insert google analytic to my zen cart website?
    By sunzhoujian in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 Aug 2009, 08:49 PM
  3. Analytic
    By ykaldes in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 6 Jan 2009, 04:45 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR