Thread: Tracking sales

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Tracking sales

    Hi,

    We are investigating some tracking software for our store and I want to track the dollar amount per sale and the order number for that sale.

    Am I correct in the following variables?

    Total amount of order: $order
    Order Number: $zv_orders_id

    If these are correct then as far as I can tell the order amount is found on the confirmation page and the order number is found on the checkout success page.

    Can I place a line of code in the checkout success page that gives me both variable's information? If so, can someone give me a clue as to what that line of code would be?

    Thanks

    Rick

  2. #2
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Re: Tracking sales

    Can anyone help me on this?

    Thanks

    Rick

  3. #3
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Re: Tracking sales

    I keep looking for a solution to this issue. I am able to track the sale without any problem and this script will allow for a dynamic tracking of the sale amount and the order it came from. I need to insert the two variables I am looking for which is total sale and order id.

    The two variables I am using at present are $order_id and $order_total.

    I don't know if this is correct or not. The sale itself is being tracked but I am not getting the order id nor the order total so I assume these variables are not what I am looking for.

    I am also tracking it from the tpl_checkout_default.php page. Maybe I can't even pull those variables from there. I don't know since I am not php literate.

    Thanks in advance for any help you can give me.

    Rick

  4. #4
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    608
    Plugin Contributions
    0

    Default Re: Tracking sales

    There is a mod released by Andrew for Google Analytics.

  5. #5
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Re: Tracking sales

    My tracking software will tell me where they come from and where they end up. What I want to know is what they spend. I want to track my advertising and my search engine referrals.

    Thanks

    Rick

  6. #6
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    608
    Plugin Contributions
    0

    Default Re: Tracking sales

    That's what Google Analytics will do once you enable the e-commerce portion and add the code to your shop or use Andrew's mod.

  7. #7
    Join Date
    Dec 2006
    Posts
    7
    Plugin Contributions
    0

    Default Re: Tracking sales

    What tracking software do you want to use?

    Google Analytics works, but there are many other analytics solutions that work better.

    I found a way to make some modifications and gather that info on the checkout success page, but it will take some modification.

    Let me know where you need to put the code, and I can show you what I did to implement my solution

  8. #8
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Re: Tracking sales

    It doesn't really matter where I put the code on the checkout success page I just need to know the correct variables to pull.

    Can anyone tell me what the correct variables are for order total and order id?

    Thanks

    Rick

  9. #9
    Join Date
    Aug 2004
    Posts
    503
    Plugin Contributions
    0

    Default Re: Tracking sales

    OK,

    Someone on this board must know the answer to my question.

    Here is the javascript code and instructions from the tracking software I am testing. I have 30 days to decide to keep it or not and really want to know if the dynamic tracking function works correctly. Everything else I have tested works great.
    Enter your shopping cart variable for the sales amount after after the a= variable and your shopping cart variable for the order number after the w= variable:

    Code:
    <!--Start of HTML snippet-->
     < img width=1 height=1 src='http://www.your-domain.com/axroi/conversion.php?t=Sale&a=$SALES-AMOUNT&w=$ORDER-NUMBER'>
     < !--End of HTML snippet-->
    THIS IS WHAT I AM USING WHICH IS ONLY RETURNING THE VARIABLE NAME I SPECIFIED

    Code:
    <!--Start of HTML snippet-->
    < img width=1 height=1 src='http://www.your-domain.com/axroi/conversion.php?t=Sale&a=$order_total&w=$order_id'>
    < !--End of HTML snippet-->
    Enter that code on your order confirmation page. (I have it place on my checkout success page) AxROI will automatically track the correct purchase amount and the order number then.

    Note that the shopping cart variables for the sales amount and the order number are different in different shopping cart solutions. Ask your shopping cart provider for the variables you can use for the sales amount and the order number on your order confirmation page.
    Thanks in advance for anyone who can help me.

    Rick

  10. #10
    Join Date
    Dec 2006
    Posts
    7
    Plugin Contributions
    0

    Default Re: Tracking sales

    Here is what I did to modify the google analytics mods to work with my tracking tools.

    The code below runs the query and sets the variables.

    //check to see if current page is checkout_success and include indextools for order if it is
    if($page_directory == 'includes/modules/pages/checkout_success')
    {
    /**
    * Based on
    * jscript_google_analytics.php
    *
    * @package zen-cart statistic
    * @copyright Copyright 2005-2006 Andrew Berezin
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: jscript_google_analytics.php,v 1.0.0 18.08.2006 19:19 Andrew Berezin [email protected] $
    */
    $order_query = "select orders_id, " . GOOGLE_ANALYTICS_TARGET . "_city as city, " . GOOGLE_ANALYTICS_TARGET . "_state as state, " . GOOGLE_ANALYTICS_TARGET . "_country as country from " . TABLE_ORDERS . " where customers_id = :customersID order by date_purchased desc limit 1";
    $order_query = $db->bindVars($order_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $order = $db->Execute($order_query);

    $google_analytics = array();

    $totals = $db->Execute("select value, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order->fields['orders_id'] . "' and (class = 'ot_total' or class = 'ot_tax' or class = 'ot_shipping')");
    while (!$totals->EOF) {
    $google_analytics[$totals->fields['class']] = number_format($totals->fields['value'], 2, '.', '');
    $totals->MoveNext();
    }
    // UTM:T|[order-id]|[affiliation]|[total]|[tax]|[shipping]|[city]|[state]|[country]
    $transaction = 'UTM:T|' . $order->fields['orders_id'] . '|' . GOOGLE_ANALYTICS_AFFILIATION . '|' . $google_analytics['ot_total'] . '|' . $google_analytics['ot_tax'] . '|' . $google_analytics['ot_shipping'] . '|' . $order->fields['city'] . '|' . $order->fields['state'] . '|' . $order->fields['country'];

    $products = $db->Execute("select products_id, " . GOOGLE_ANALYTICS_SKUCODE . " as skucode, products_name, final_price, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $order->fields['orders_id'] . "'");
    $items = "";
    while (!$products->EOF) {
    $category_query = "select cd.categories_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on (cd.categories_id = p2c.categories_id) where p2c.products_id = '" . $products->fields['products_id'] . "' and cd.language_id = :languagesID limit 1";
    $category_query = $db->bindVars($category_query, ':languagesID', $_SESSION['languages_id'], 'integer');
    $category = $db->Execute($category_query);
    // UTM:I|[order-id]|[sku/code]|[productname]|[category]|[price]|[quantity]
    $items .= ' UTM:I|' . $order->fields['orders_id'] . '|' . $products->fields['skucode'] . '|' . $products->fields['products_name'] . '|' . $category->fields['categories_name'] . '|' . number_format($products->fields['final_price'], 2, '.', '') . '|' . $products->fields['products_quantity'];
    $products->MoveNext();
    }
    Then I post the information to my tracking below.

    You'll have to play with it to when your put it in your script, but the order id is
    '.$order->fields['orders_id'].' and Amount is '.$google_analytics['ot_total'].'


    //echo transaction data
    echo ' <!-- IndexTools Customization Code -->
    <!-- Remove leading // to activate custom variables -->
    <script language="Javascript">
    var ACTION="1";
    var MEMBERID='.$_SESSION['customer_id'].';
    var ORDERID='.$order->fields['orders_id'].';
    var AMOUNT='.$google_analytics['ot_total'].';
    var _S_SHIPPING='.$google_analytics['ot_shipping'].';
    var _S_SKU='.$products->fields['skucode'].';
    var _S_UNITS='.$products->fields['products_quantity'].';
    </script>';
    }
    ?>
    Let me know if that works for you.

    I know there is extra code in this that is not needed since I am not using GA, but I just haven't had time to clean it up. Regardless, it works for what I want.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Tracking affiliate sales
    By Lian in forum General Questions
    Replies: 0
    Last Post: 21 May 2008, 10:48 PM
  2. adding sales tracking javascript
    By longstockings in forum General Questions
    Replies: 1
    Last Post: 20 Jul 2006, 03:14 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