Results 1 to 10 of 108

Threaded View

  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Google Ecommerce Tracking

    Found multiple posts with no clear answers on this.. Found the code below for adding Google ecommerce tracking in an old post.
    Can someone confirm this is correct or guide me to WHERE I might find the right code for Zen Cart to add ecommerce tracking..

    Code:
    <script type="text/javascript">
    
    var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-xxxxxx-1']);
      _gaq.push(['_trackPageview']);
      _gaq.push(['_addTrans','<?php echo $zv_orders_id ?>','','<?php echo $zv_order_total_cd ?>','<?php echo $zv_order_tax ?>','<?php echo $order_summary['shipping'] ?>','<?php echo $zv_order_city ?>','<?php echo $zv_order_state ?>','<?php echo $zv_order_country ?>']);
    
      _gaq.push(['_addItem','<?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  $zv_orders_id . '\',
    \'' . $products_array_google[$i]['model'] . '\',
    \'' . $products_array_google[$i]['text'] . '\',
    \'\',
    \'' . $products_array_google[$i]['price'] . '\',
    \'' . $products_array_google[$i]['quantity'] . '\'
    ' . ((($i+1)<$n) ? ',\'' : '' ) ;
    
    }
    }
    
    ?>])
      _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    
      (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);
      })();
       __utmSetTrans()
    
    </script>
    Last edited by DivaVocals; 30 Apr 2015 at 09:41 AM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

 

 

Similar Threads

  1. Replies: 6
    Last Post: 3 Oct 2013, 10:36 PM
  2. Ecommerce Tracking code for Google Analytics
    By Endre in forum General Questions
    Replies: 7
    Last Post: 14 Nov 2012, 03:20 PM
  3. MailChimp Ecommerce MC360 tracking?
    By irishshopper in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 26 Oct 2010, 11:21 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