Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2004
    Posts
    237
    Plugin Contributions
    2

    Default tracking code for perfect audience

    I need a little help capturing product ids.

    I have this tracking code (below) running on my site. I successfully set it up to capture the order number and the order total (see below.) There is third option, product ID. I can' figure out how to capture it. This is the id of whatever item they are looking at. It will be used to create retargeting ads.

    ORDER NUMBER
    <?php echo $zv_orders_id; ?>

    ORDER TOTAL
    <?php echo $orders->fields['order_total']; ?>

    PRODUCT ID NEEDED

    The code inserted on every page is below. Any help would be appreciated.
    Tom

    <script type="text/javascript">
    (function() {
    window._pa = window._pa || {};
    // _pa.orderId = "<?php echo $zv_orders_id; ?>"; // OPTIONAL: attach unique conversion identifier to conversions
    // _pa.revenue = "<?php echo $orders->fields['order_total']; ?>"; // OPTIONAL: attach dynamic purchase values to conversions
    // _pa.productId = "myProductId"; // OPTIONAL: Include product ID for use with dynamic ads
    var pa = document.createElement('script'); pa.type = 'text/javascript'; pa.async = true;
    pa.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + "//tag.perfectaudience.com/serve/xxxxxxxxxxxxxxxxxxxxx.js";
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pa, s);
    })();
    </script>

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: tracking code for perfect audience

    PHP Code:
    <?php echo $_GET['products_id']; ?>
    This will be null for non-product pages, and have the id on individual product pages.

  3. #3
    Join Date
    Oct 2004
    Posts
    237
    Plugin Contributions
    2

    Default Re: tracking code for perfect audience

    Thanks!! I appreciate it.
    Tom

  4. #4
    Join Date
    Oct 2004
    Posts
    237
    Plugin Contributions
    2

    Default Re: tracking code for perfect audience

    I wonder if you might be able to offer help filling in the blanks for the shopping.com ROI tracker.

    It wants to be passed order info as below.

    _roi.push(['_addItem',
    '', // Merchant sku
    '', // Product name
    '', // Category id
    '', // Category name
    '', // Unit price
    '' // Item quantity
    ]);


    Given the previous answer <?php echo $_GET['products_id']; ?> I wonder if there is a way I can see the variables available so I don't have to bother the zencart geniuses? I can make guesses -- like category id may be <?php echo $_GET['category_id']; ?>

    I have included the full script which at the moment is located at includes/modules/pages/checkout_success

    Thanks much
    Tom



    <script type="text/javascript">
    var _roi = _roi || [];

    // Step 1: add base order details

    _roi.push(['_setMerchantId', 'XXXXXXXX']); // required
    _roi.push(['_setOrderId', '<?php echo $zv_orders_id; ?>']); // unique customer order ID
    _roi.push(['_setOrderAmount', '<?php echo $orders->fields['order_total']; ?>']); // order total without tax and shipping
    _roi.push(['_setOrderNotes', '']); // notes on order, up to 50 characters

    // Step 2: add every item in the order
    // where your e-commerce engine loops through each item in the cart and prints out _addItem for each
    // please note that the order of the values must be followed to ensure reporting accuracy

    _roi.push(['_addItem',
    '', // Merchant sku
    '', // Product name
    '', // Category id
    '', // Category name
    '', // Unit price
    '' // Item quantity
    ]);

    // Step 3: submit transaction to ECN ROI tracker

    _roi.push(['_trackTrans']);
    </script>
    <script type="text/javascript" src="https://stat.dealtime.com/ROI/ROI2.js"></script>

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: tracking code for perfect audience

    Quote Originally Posted by tomarriola View Post
    I wonder if you might be able to offer help filling in the blanks for the shopping.com ROI tracker.

    It wants to be passed order info as below.

    _roi.push(['_addItem',
    '', // Merchant sku
    '', // Product name
    '', // Category id
    '', // Category name
    '', // Unit price
    '' // Item quantity
    ]);


    Given the previous answer <?php echo $_GET['products_id']; ?> I wonder if there is a way I can see the variables available so I don't have to bother the zencart geniuses? I can make guesses -- like category id may be <?php echo $_GET['category_id']; ?>

    I have included the full script which at the moment is located at includes/modules/pages/checkout_success

    Thanks much
    Tom



    <script type="text/javascript">
    var _roi = _roi || [];

    // Step 1: add base order details

    _roi.push(['_setMerchantId', 'XXXXXXXX']); // required
    _roi.push(['_setOrderId', '<?php echo $zv_orders_id; ?>']); // unique customer order ID
    _roi.push(['_setOrderAmount', '<?php echo $orders->fields['order_total']; ?>']); // order total without tax and shipping
    _roi.push(['_setOrderNotes', '']); // notes on order, up to 50 characters

    // Step 2: add every item in the order
    // where your e-commerce engine loops through each item in the cart and prints out _addItem for each
    // please note that the order of the values must be followed to ensure reporting accuracy

    _roi.push(['_addItem',
    '', // Merchant sku
    '', // Product name
    '', // Category id
    '', // Category name
    '', // Unit price
    '' // Item quantity
    ]);

    // Step 3: submit transaction to ECN ROI tracker

    _roi.push(['_trackTrans']);
    </script>
    <script type="text/javascript" src="https://stat.dealtime.com/ROI/ROI2.js"></script>
    Superglobals plugin.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Feb 2009
    Posts
    861
    Plugin Contributions
    0

    Default Re: tracking code for perfect audience

    Maybe a simplistic question but where does that code go?

    <?php echo $_GET['products_id']; ?>

    Also, is there a way to track categories instead/in addition to individual products? will it work with 'products_id'?

    Nevermind, a second reading helped! Also, can you confirm that the category can be tracked instead of the individual product?

  7. #7
    Join Date
    Oct 2004
    Posts
    237
    Plugin Contributions
    2

    Default Re: tracking code for perfect audience

    You can target categories but that is done in the perfectaudience side.

    In perfectaudience you can cookie/target people who made it to checkout and can make another target for those that visited your category. Then you can make an ad that shows to all people who visited the category but did not checkout.

    The targeting is done by matching url strings-- in this instance it something like-- if the url contains "cPath=55" then it is targeted.
    Tom

  8. #8
    Join Date
    Oct 2004
    Posts
    237
    Plugin Contributions
    2

    Default Re: tracking code for perfect audience

    Quote Originally Posted by tomarriola View Post

    // _pa.orderId = "<?php echo $zv_orders_id; ?>"; // OPTIONAL: attach unique conversion identifier to conversions
    // _pa.revenue = "<?php echo $orders->fields['order_total']; ?>"; // OPTIONAL: attach dynamic purchase values to conversions
    // _pa.productId = "myProductId"; // OPTIONAL: Include product ID for use with dynamic ads
    Make sure you uncomment the above lines to be

    _pa.orderId = "<?php echo $zv_orders_id; ?>"; // OPTIONAL: attach unique conversion identifier to conversions
    _pa.revenue = "<?php echo $orders->fields['order_total']; ?>"; // OPTIONAL: attach dynamic purchase values to conversions
    _pa.productId = "<?php echo $_GET['products_id']; ?>"; // OPTIONAL: Include product ID for use with dynamic ad

 

 

Similar Threads

  1. Ecommerce Tracking code for Google Analytics
    By Endre in forum General Questions
    Replies: 7
    Last Post: 14 Nov 2012, 03:20 PM
  2. Adding tracking code for analytics To Every Page?
    By fabienne in forum Basic Configuration
    Replies: 4
    Last Post: 14 Jul 2010, 08:02 PM
  3. Adding tracking code for purchase
    By clarkeyi in forum General Questions
    Replies: 1
    Last Post: 20 Apr 2009, 11:02 PM
  4. Code for Tracking Purposes
    By smartmomma in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 17 Oct 2006, 10:13 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