Page 26 of 68 FirstFirst ... 16242526272836 ... LastLast
Results 251 to 260 of 672
  1. #251
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Google Analytics Integration

    Quote Originally Posted by davemehta View Post
    I just signed up for Google Analytics. My question is: What's the difference between this mod and just directly inserting the google tracking script code into the template/common/html_header.php file?
    There is no difference (the mod makes it easier without the need to "touch code" from within the Admin).

    By the way, I would recommend that if you are going to insert the code yourself, then don't insert it into the header file. I would recommend inserting it into the "tpl_main_page.php" found in the "common" folder (includes/templates/[your template]/common ).

    That is the better place to put it (and the spot that the Simple Google Analytics inserts it).

    I have inserted the Google Analytics code (along with e-com tracking and conversion tracking) on older carts just by pasting into the bottom as indicated here. Again, the mod provided makes it a bit easier. (Why not take the "easy route")?
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

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

    Default Re: Google Analytics Integration

    Quote Originally Posted by davemehta View Post
    What's the difference between this mod and just directly inserting the google tracking script code into the template/common/html_header.php file?
    If you "directly inserting the google tracking script code" in template/common/tpl_footer.php:
    1. You can't use page names in Google Analytics (you can use only title for a name of page if you add some code to tracking script);
    2. You should add in a tracking script ssl checking;
    3. You can't track e-commerce transactions;

  3. #253
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Google Analytics Integration

    Quote Originally Posted by a_berezin View Post
    If you "directly inserting the google tracking script code" in template/common/tpl_footer.php:
    1. You can't use page names in Google Analytics (you can use only title for a name of page if you add some code to tracking script);
    2. You should add in a tracking script ssl checking;
    3. You can't track e-commerce transactions;
    Actually, you can track all of the following by inserting code (into two different files) into the tpl_footer.php file AND /includes/modules/pages/checkout_success/header_php.php

    (again, this works perfectly, but it may be much easier / faster to use the mod). I listed the code below to do it all (if you must insert by hand). I have been using it on a few Zen installs for over 6 months now with no problems.

    To do all of the above and PLUS add "Google Conversion Tracking" as well to the mix, the following code should be inserted at the bottom of the tpl_footer.php (or tpl_main_page just above the closing </BODY> tag)

    Keep in mind that the "xxxxxxx" shown in all areas below represents where your own Google ID would go (generated from within Google).

    Also keep in mind that if you would like to actually track the "conversion value" (to get more accurate cost data for PPC reporting) then you would replace
    if (1.0) {
    google_conversion_value = 1.0;
    }

    with

    if (echo $zv_order_total_cd) {
    google_conversion_value = echo $zv_order_total_cd;
    }


    Ok, on with the code again, inserted at the bottom of the tpl_footer.php (or tpl_main_page just above the closing </BODY> tag)


    PHP Code:
    <!-- Tracking -->
    <?php // If page is SSL then use Secure Code
    if($_SERVER['HTTPS']=='on'){
    ?>



    <!-- Google Analytics -->
    <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-xxxxxx-x";
    urchinTracker();
    </script>
         <!-- /Google Analytics -->
        <?php 
        
    if ($_GET['main_page']=="checkout_success") { // if transaction is a successful purchase then record the order details
        
    ?>
             <!-- Google Analytics E-Commerce Tracking (must go below standard Analytics code)-->
            <body onLoad="javascript:__utmSetTrans()"> 
            <form style="display:none;" name="utmform">
            <textarea id="utmtrans">UTM:T|<?php echo $zv_orders_id ?>||<?php echo $zv_order_total_cd ?>|<?php echo $zv_order_tax ?>|0.00|<?php echo $zv_order_city ?>|<?php echo $zv_order_state ?>|<?php echo $zv_order_country ?>
            <?php // Loop through products purchased to track in Google (these come from the "cart_orders_products TABLE)
                  //sku = "products_model";  productname = "products_name"; category = ""; price = "final_price"; quantity = "products_quantity"
                  
    $products_displayed_google = array();
                  for (
    $i=0$n=sizeof($products_array_google); $i<$n$i++) {
                    if (!
    in_array($products_array_google[$i]['id'], $products_displayed_google)) {
                      echo 
    'UTM:I|' $zv_orders_id '|' $products_array_google[$i]['model'] . '|' $products_array_google[$i]['text'] . '||' $products_array_google[$i]['price'] . '|' $products_array_google[$i]['quantity'];
                      
    $products_displayed_google[] = $products_array_google[$i]['id'];
                    }
                  }
                
    ?>
            </textarea>
            </form> 
             <!-- /Google Analytics E-Commerce Tracking -->

    <!-- Google Code for purchase Conversion Page -->
    <script language="JavaScript" type="text/javascript">
    <!--
    var google_conversion_id = xxxxxxxxxx;
    var google_conversion_language = "en_US";
    var google_conversion_format = "1";
    var google_conversion_color = "FFFFFF";
    if (1.0) {
      var google_conversion_value = 1.0;
    }
    var google_conversion_label = "purchase";
    //-->
    </script>
    <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/xxxxxxxxxx/?value=<?php echo $zv_order_total_cd ?>&label=purchase&script=0">
    </noscript>

         <?php //End if main page is "checkout_success"?>
      
    <?php // Else use Non-Secure Code
    } else {
    ?>


     <!-- Google Analytics -->
     <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-xxxxxx-x";
    urchinTracker();
    </script>
     <!-- /Google Analytics -->
     <?php ?>


    <!-- / Tracking -->
    The above code does the following:

    1) Checks whether or not the page is a Secure page and then uses the appropriate code based on that check (secure or not secure)

    2) Inserts Google Analytics Tracking

    3) Inserts Google E-Commerce Tracking

    4) Inserts Google Conversion Tracking.


    Then, insert the following code into the /includes/modules/pages/checkout_success/header_php.php file just below the following line $zv_order_total_cd = $orders->fields['order_total']; (approximately line # 74.

    PHP Code:
      // Added the below field for Google Analytics E-commerce Tracking (in the footer file)
      
    $zv_order_tax $orders->fields['order_tax'];
      
    $zv_order_city $orders->fields['delivery_city'];
      
    $zv_order_state $orders->fields['delivery_state'];
      
    $zv_order_country $orders->fields['delivery_country'];
      
      
    // Google Analytics Tracking (This can be removed and not harm anything)
        //Altered code below to accomdate additional fields that Google Analytics can Track
        
    $products_query "select products_id, products_name, products_model,products_price, products_quantity from " TABLE_ORDERS_PRODUCTS "
                           where orders_id = '" 
    $zv_orders_id "'
                           order by products_name"
    ;
          
    $products_google $db->Execute($products_query);
            
    //********************Google codes**************************
            
    while (!$products_google->EOF) {
              
    $products_array_google[] = array('id' => $products_google->fields['products_id'],
                                        
    'text' => $products_google->fields['products_name'],
                                        
    'model' => $products_google->fields['products_model'],
                                        
    'price' => $products_google->fields['products_price'],
                                        
    'quantity' => $products_google->fields['products_quantity']);
              
    $products_google->MoveNext();
            }
            
    //*************************End Google Codes*******************
      // End Google Analytics Code 
    Everything Google offers for the most part and then some. It can be done, just requires more steps to complete.
    Last edited by econcepts; 18 May 2007 at 02:19 PM. Reason: spelling error
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  4. #254
    Join Date
    May 2007
    Posts
    1
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    Quote Originally Posted by econcepts View Post
    Actually, you can track all of the following by inserting code (into two different files) into the tpl_footer.php file AND /includes/modules/pages/checkout_success/header_php.php

    (again, this works perfectly, but it may be much easier / faster to use the mod). I listed the code below to do it all (if you must insert by hand). I have been using it on a few Zen installs for over 6 months now with no problems.

    To do all of the above and PLUS add "Google Conversion Tracking" as well to the mix, the following code should be inserted at the bottom of the tpl_footer.php (or tpl_main_page just above the closing </BODY> tag)

    Keep in mind that the "xxxxxxx" shown in all areas below represents where your own Google ID would go (generated from within Google).

    Also keep in mind that if you would like to actually track the "conversion value" (to get more accurate cost data for PPC reporting) then you would replace
    if (1.0) {
    google_conversion_value = 1.0;
    }

    with

    if (echo $zv_order_total_cd) {
    google_conversion_value = echo $zv_order_total_cd;
    }


    Ok, on with the code again, inserted at the bottom of the tpl_footer.php (or tpl_main_page just above the closing </BODY> tag)


    PHP Code:
    <!-- Tracking -->
    <?php // If page is SSL then use Secure Code
    if($_SERVER['HTTPS']=='on'){
    ?>



    <!-- Google Analytics -->
    <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-xxxxxx-x";
    urchinTracker();
    </script>
         <!-- /Google Analytics -->
        <?php 
        
    if ($_GET['main_page']=="checkout_success") { // if transaction is a successful purchase then record the order details
        
    ?>
             <!-- Google Analytics E-Commerce Tracking (must go below standard Analytics code)-->
            <body onLoad="javascript:__utmSetTrans()"> 
            <form style="display:none;" name="utmform">
            <textarea id="utmtrans">UTM:T|<?php echo $zv_orders_id ?>||<?php echo $zv_order_total_cd ?>|<?php echo $zv_order_tax ?>|0.00|<?php echo $zv_order_city ?>|<?php echo $zv_order_state ?>|<?php echo $zv_order_country ?>
            <?php // Loop through products purchased to track in Google (these come from the "cart_orders_products TABLE)
                  //sku = "products_model";  productname = "products_name"; category = ""; price = "final_price"; quantity = "products_quantity"
                  
    $products_displayed_google = array();
                  for (
    $i=0$n=sizeof($products_array_google); $i<$n$i++) {
                    if (!
    in_array($products_array_google[$i]['id'], $products_displayed_google)) {
                      echo 
    'UTM:I|' $zv_orders_id '|' $products_array_google[$i]['model'] . '|' $products_array_google[$i]['text'] . '||' $products_array_google[$i]['price'] . '|' $products_array_google[$i]['quantity'];
                      
    $products_displayed_google[] = $products_array_google[$i]['id'];
                    }
                  }
                
    ?>
            </textarea>
            </form> 
             <!-- /Google Analytics E-Commerce Tracking -->

    <!-- Google Code for purchase Conversion Page -->
    <script language="JavaScript" type="text/javascript">
    <!--
    var google_conversion_id = xxxxxxxxxx;
    var google_conversion_language = "en_US";
    var google_conversion_format = "1";
    var google_conversion_color = "FFFFFF";
    if (1.0) {
      var google_conversion_value = 1.0;
    }
    var google_conversion_label = "purchase";
    //-->
    </script>
    <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/xxxxxxxxxx/?value=<?php echo $zv_order_total_cd ?>&label=purchase&script=0">
    </noscript>

         <?php //End if main page is "checkout_success"?>
      
    <?php // Else use Non-Secure Code
    } else {
    ?>


     <!-- Google Analytics -->
     <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-xxxxxx-x";
    urchinTracker();
    </script>
     <!-- /Google Analytics -->
     <?php ?>


    <!-- / Tracking -->
    The above code does the following:

    1) Checks whether or not the page is a Secure page and then uses the appropriate code based on that check (secure or not secure)

    2) Inserts Google Analytics Tracking

    3) Inserts Google E-Commerce Tracking

    4) Inserts Google Conversion Tracking.


    Then, insert the following code into the /includes/modules/pages/checkout_success/header_php.php file just below the following line $zv_order_total_cd = $orders->fields['order_total']; (approximately line # 74.

    PHP Code:
      // Added the below field for Google Analytics E-commerce Tracking (in the footer file)
      
    $zv_order_tax $orders->fields['order_tax'];
      
    $zv_order_city $orders->fields['delivery_city'];
      
    $zv_order_state $orders->fields['delivery_state'];
      
    $zv_order_country $orders->fields['delivery_country'];
      
      
    // Google Analytics Tracking (This can be removed and not harm anything)
        //Altered code below to accomdate additional fields that Google Analytics can Track
        
    $products_query "select products_id, products_name, products_model,products_price, products_quantity from " TABLE_ORDERS_PRODUCTS "
                           where orders_id = '" 
    $zv_orders_id "'
                           order by products_name"
    ;
          
    $products_google $db->Execute($products_query);
            
    //********************Google codes**************************
            
    while (!$products_google->EOF) {
              
    $products_array_google[] = array('id' => $products_google->fields['products_id'],
                                        
    'text' => $products_google->fields['products_name'],
                                        
    'model' => $products_google->fields['products_model'],
                                        
    'price' => $products_google->fields['products_price'],
                                        
    'quantity' => $products_google->fields['products_quantity']);
              
    $products_google->MoveNext();
            }
            
    //*************************End Google Codes*******************
      // End Google Analytics Code 
    Everything Google offers for the most part and then some. It can be done, just requires more steps to complete.
    Thank you for the incredible step by step!

    I'm having one issue though -

    I don't see line:

    $zv_order_total_cd = $orders->fields['order_total'];

    under

    /includes/modules/pages/checkout_success/header_php.php

    I am using the latest version of zen cart.... could you advise? :)

    thanks!

  5. #255
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Google Analytics Integration

    Quote Originally Posted by shaitaan View Post
    Thank you for the incredible step by step!

    I'm having one issue though -

    I don't see line:

    $zv_order_total_cd = $orders->fields['order_total'];

    under

    /includes/modules/pages/checkout_success/header_php.php

    I am using the latest version of zen cart.... could you advise? :)

    thanks!

    Good point. The line I mentioned was from an older install of Zen. The line in newest versions of Zen that you will want to look for is in the same file but falls around line #54 and reads as follows:

    $orders_id = $zv_orders_id;

    In newer versions of Zen I used the simple Google analytics mod as it does not require any "code prep" to get it working. Then I include Conversion Tracking on my own. If you want to manually insert it, the code I provided here will work still.

    Make sure you also include the following line (to get the order total) if it is not already present as well.
    $zv_order_total_cd = $orders->fields['order_total'];
    Last edited by econcepts; 21 May 2007 at 12:25 PM. Reason: added another point
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  6. #256

    Default Re: Google Analytics Integration

    Been surfing through this thread, tried to d/l the mod from the first post with no luck. I would love to get google analytics running on my site without hand inputting all the coding myself, so, where can I find this download, and does it include a simple read me.txt.

  7. #257
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Google Analytics Integration

    Quote Originally Posted by RobVox View Post
    Been surfing through this thread, tried to d/l the mod from the first post with no luck. I would love to get google analytics running on my site without hand inputting all the coding myself, so, where can I find this download, and does it include a simple read me.txt.
    Download from here:

    http://www.zen-cart.com/index.php?ma...roducts_id=412

    What version of Zen are you running?
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  8. #258

    Default Re: Google Analytics Integration

    The current version: 1.3.7

    If I read that right, this mod is only good on 1.3.6???

    And, is this version Andrew's or Cuda's, or is there a difference? What I was reading made it sound like Andrew's was the easier to use and install, also allowing of admin controls?

    Thanks for the help!

  9. #259
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: Google Analytics Integration

    Quote Originally Posted by RobVox View Post
    The current version: 1.3.7

    If I read that right, this mod is only good on 1.3.6???

    And, is this version Andrew's or Cuda's, or is there a difference? What I was reading made it sound like Andrew's was the easier to use and install, also allowing of admin controls?

    Thanks for the help!
    As I have gathered from reading the forums, a version was started by Andrew sometime ago I believe. It was taken over by Cuda somewhere along the line, or he created his own version, not sure which (if you read the forums you'll see some discussion regarding this).

    As a result, Andrew no longer supports it (and says he won't). The version I pointed you to is "the" version in use now by most (supported by Cuda). I have it working on a 1.3.7 cart just fine.
    Last edited by econcepts; 6 Jun 2007 at 06:57 PM. Reason: spelling
    Eric
    20 Ways to Increase Sales Using Zen Cart
    Zen Cart contribs: Simple Google Analytics, Export Shipping Information

  10. #260
    Join Date
    May 2007
    Posts
    7
    Plugin Contributions
    0

    Default Re: Google Analytics Integration

    I had the good folks over at OpenSourceHosting install this for me, and it shows up in Admin just fine. I entered my account number and everything, but Google still says I haven't installed the Analytics code. When I go to my page and view the source, I don't find any of the google code. Is there something else I need to do?

 

 
Page 26 of 68 FirstFirst ... 16242526272836 ... 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

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