Page 8 of 68 FirstFirst ... 6789101858 ... LastLast
Results 71 to 80 of 672
  1. #71
    Join Date
    Jan 2006
    Location
    Portland, Oregon
    Posts
    276
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by cuda View Post
    Well I have been looking to use this module but concerned that if google analytics goes down my site will not load because this mod includes everything at the top. Google actually tells you to include the code at the bottom of the page just before the </body> tag to avoid this issue. So I have come up with a hack to include the code at the bottom. Here it is:

    First we need to move files around a bit so they will not load at the top but at the bottom.

    1. Create a new folder in includes/templates/yourtemplate named 'bottom_jscript'

    2. Now move 'jscript_google_analytics.php' to the new folder

    3. Create a new folder in includes/modules/pages/checkout_success named 'google_analytics'

    4. Move 'jscript_google_analytics.php' and 'on_load_google_analytics.js' to this new folder.

    Ok now we have our files in the new folders lets move to the hack.

    5. We will add the code below to includes/templates/yourtemplate/common/tpl_main_page.php at the very bottom just before the body tag as instructed by google - and yes I would jump off a bridge if google said too....

    PHP Code:
    /** Google Analytics Main Code include
     * load all site-wide bottom jscript_*.php files from includes/templates/YOURTEMPLATE/bottom_jscript/, alphabetically
     */
      
    $directory_array $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE$current_page_base,'bottom_jscript'), '/^jscript_/''.php');
      while(list (
    $key$value) = each($directory_array)) {

    /**
     * include content from all site-wide bottom jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
     * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
     */
        
    require($template->get_template_dir('.php',DIR_WS_TEMPLATE$current_page_base,'bottom_jscript') . '/' $value); echo "\n";
      }

    //check to see if current page is checkout_success and include google analytics for order if it is
    if($page_directory == 'includes/modules/pages/checkout_success')
    {

    /**
     * load all google_analytics-specific jscript_*.js files from includes/modules/pages/PAGENAME/google_analytics, alphabetically
     */
      
    $directory_array $template->get_template_part($page_directory 'google_analytics''/^jscript_/''.js');
      while(list (
    $key$value) = each($directory_array)) {
        echo 
    '<script type="text/javascript" src="' $page_directory 'google_analytics' '/' $value '"></script>' "\n";
      }
    /**
     * include content from all google_analytics-specific jscript_*.php files from includes/modules/pages/PAGENAME/google_analytics, alphabetically.
     */
      
    $directory_array $template->get_template_part($page_directory '/google_analytics''/^jscript_/');
      while(list (
    $key$value) = each($directory_array)) {
    /**
     * include content from all google_analytics-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
     * These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
     */
        
    require($page_directory '/google_analytics' '/' $value); echo "\n";
      }

    That is it now the code will be included on each page and the cart contents will be included at checkout success, had to use a simple check to avoid running code for every page as it is not needed.

    I will be testing this but works so far let me know if you have any thoughts.
    Hi cuda,
    I was just wondering if the google analytics solution you came up with to move the code to the footer as seen above is still working?

    thanks in advance
    hope to hear from you soon

  2. #72
    Join Date
    Jul 2006
    Posts
    129
    Plugin Contributions
    1

    Default Re: Google Analytics Integration

    The problem I am having is getting the e-commerce analytics to work. The tracking all works great in this hack but no e-commere sales tracking does not.

    I also changed the code in includes/modules/pages/checkout_success/google_analytics/jscript_google_analytics.php

    to echo just a hidden form and not a JS function (don't understand why this was used in the first place).

    to do this change this at the bottom:

    Code:
    echo '<script type="text/javascript">
    function zen_utmSetTrans() {
      var divHTML = "";
      divHTML += "<form style=\"display:none;\" name=\"utmform\">";
      divHTML += "  <textarea id=\"utmtrans\">";
      divHTML += "' . addslashes($transaction) . '";
      divHTML += "' . addslashes(trim($items)) . '";
      divHTML += "  </textarea>";
      divHTML += "</form>";
      var divUTM = document.createElement("div");
      divUTM.id = "utmform";
      divUTM.style.display = "none";
      divUTM.innerHTML = divHTML;
      document.body.appendChild(divUTM);
      __utmSetTrans();
    }
    </script>';
    to this:

    Code:
    echo '<script language="text/javascript">
    __utmSetTrans(); </script>'  .
    '<form style="display:none;" name="utmform">
    <textarea id="utmtrans">' 
    . addslashes($transaction) . ' ' 
    . addslashes(trim($items))
    . '</textarea>
    </form>';
    now what is echoed on the checkout_success page is something like this:

    Code:
    <script type="text/javascript">
    _uacct = "UA-XXXXXX-1";
    urchinTracker();
    </script>
    <script language="text/javascript">
    __utmSetTrans(); </script><form style="display:none;" name="utmform">
    <textarea id="utmtrans">UTM:T|82||28.46|1.56|7.95|City|State|United States UTM:I|82|64|Product name|Product Category|18.95|1</textarea>
    </form>
    This seems to follow what the google analytics help page suggests is needed here:
    http://www.google.com/support/analyt...203&topic=7282

    The info we are getting is great but being able to track sales would be even better. Maybe it has something to do with all the cart info is on one line I will have to test that. Any help on this would be great.

    Are people who are using the default module able to track sales?
    ---------------------------------
    Barracuda Productions pure instincts

  3. #73
    Join Date
    Jul 2006
    Posts
    129
    Plugin Contributions
    1

    Default Re: Google Analytics Integration

    Doing some more reading it apears you need to also set up a goal in google analytics see these resources:

    info from another cart system that you must setup a goal:
    http://forums.volusion.com/archive/index.php/t-810.html

    setting up a goal:
    http://www.google.com/support/analyt...926&topic=7282
    http://www.google.com/support/analyt...y?answer=26910

    hope these help some will report back if setting up a goal solved the e-commerce tracking problem...stay tuned
    ---------------------------------
    Barracuda Productions pure instincts

  4. #74
    Join Date
    Jan 2006
    Location
    Portland, Oregon
    Posts
    276
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by cuda View Post
    Doing some more reading it apears you need to also set up a goal in google analytics see these resources:

    info from another cart system that you must setup a goal:
    http://forums.volusion.com/archive/index.php/t-810.html

    setting up a goal:
    http://www.google.com/support/analyt...926&topic=7282
    http://www.google.com/support/analyt...y?answer=26910

    hope these help some will report back if setting up a goal solved the e-commerce tracking problem...stay tuned
    Yeah I wasn't ready to install it until I was sure it was working properly. I also am reticent to install the latest patch because there has been some issues regarding some contributions and I just haven't had time to go chasing solutions to problems I can avoid for now.

    I really need to set up my store for testing on my computer. That would help tons.

    Let me know if it works. My goal are working now but I do not have the hack that you posted.

    mafiasam

  5. #75
    Join Date
    Jul 2006
    Posts
    129
    Plugin Contributions
    1

    Default Re: Google Analytics Integration

    once I get it working perfectly, at least for the shop I am workin on, I will try and package it all up for everyone as a mod. With better directions.
    ---------------------------------
    Barracuda Productions pure instincts

  6. #76
    Join Date
    Jan 2006
    Location
    Portland, Oregon
    Posts
    276
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by cuda View Post
    once I get it working perfectly, at least for the shop I am workin on, I will try and package it all up for everyone as a mod. With better directions.
    thanks cuda

  7. #77
    Join Date
    Jul 2006
    Posts
    129
    Plugin Contributions
    1

    Default Re: Google Analytics Integration

    I am still having troubles getting analytics to track my sales it tracks my funnel goal to conversion but nothing for product info.

    If someone has google analytics tracking your site and getting sales data could you please post the code from your checkout page so I can get this resolved. So an example from a site that is getting product info from there checkout_success page would be greatly appreciated!!!

    Thanks all
    ---------------------------------
    Barracuda Productions pure instincts

  8. #78
    Join Date
    Jan 2006
    Location
    Portland, Oregon
    Posts
    276
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by cuda View Post
    I am still having troubles getting analytics to track my sales it tracks my funnel goal to conversion but nothing for product info.

    If someone has google analytics tracking your site and getting sales data could you please post the code from your checkout page so I can get this resolved. So an example from a site that is getting product info from there checkout_success page would be greatly appreciated!!!

    Thanks all
    i'm not really getting that info either unless you look at certain reports. what reports are you trying to retrieve the product info from. the only product info I can find is in the "reverse goal path" report under "content optimization"/"goals & funnel process". you kind of have to do some deduction I guess and compare your zencart orders to the "defined funnel navigation" and other reports.

    if anyone can back me up here or prove me wrong please let me know because all that is holding cuda back from confirming his automated fix for the google analytics code placement is a little testing/proof that his is working.

  9. #79
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: Google Analytics Integration

    I can not understand your problems. My variant successfully works on several shops.

  10. #80
    Join Date
    Jan 2006
    Location
    Portland, Oregon
    Posts
    276
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by a_berezin View Post
    I can not understand your problems. My variant successfully works on several shops.
    does it place the code in the footer as suggested by google?

 

 
Page 8 of 68 FirstFirst ... 6789101858 ... LastLast

Similar Threads

  1. Google Analytics: Site Search Integration
    By saitomedia in forum General Questions
    Replies: 1
    Last Post: 29 Jul 2010, 08:08 AM
  2. google analytics integration
    By amnon_d in forum General Questions
    Replies: 3
    Last Post: 14 Jul 2009, 12:04 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