Thread: Tracking sales

Results 1 to 10 of 13

Hybrid View

  1. #1
    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

  2. #2
    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

  3. #3
    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

  4. #4
    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.

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

    Default Re: Tracking sales

    Thanks. I am not a programmer but I will try and figure this out based on your example. I appreciate your time and response.

    Rick

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

    Default Re: Tracking sales

    I am not much of a programmer either. A lot of trial and error when it comes to php.

    Maybe someone else can chime in, but try

    {
    echo '<img width=1 height=1 src="http://www.your-domain.com/axroi/conversion.php?t=Sale&a='.$google_analytics['ot_total'].'&w='.$order->fields['orders_id'].'">';
    }

    in place of where I had my string

 

 

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