Forums / All Other Contributions/Addons / tracking code for perfect audience

tracking code for perfect audience

Results 1 to 8 of 8
13 Mar 2014, 17:54
#1
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

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>
13 Mar 2014, 18:02
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Posts:
21,876
Plugin Contributions:
6

Re: tracking code for perfect audience

[PHP]
<?php echo $_GET['products_id']; ?> [/PHP]
This will be null for non-product pages, and have the id on individual product pages.
13 Mar 2014, 21:54
#3
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: tracking code for perfect audience

Thanks!! I appreciate it.
Tom
13 Mar 2014, 22:03
#4
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

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>
13 Mar 2014, 22:29
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: tracking code for perfect audience

tomarriola:

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.
19 Mar 2014, 22:28
#6
caroleas avatar

caroleas

Totally Zenned

Join Date:
Feb 2009
Posts:
896
Plugin Contributions:
0

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?
19 Mar 2014, 23:36
#7
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

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
19 Mar 2014, 23:47
#8
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: tracking code for perfect audience

tomarriola:



// _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