Forums / All Other Contributions/Addons / Shopzilla Tracking Code Placement?

Shopzilla Tracking Code Placement?

Views: 7,504

Results 1 to 13 of 13
24 Feb 2009, 5:06 PM
#1
sartor avatar

sartor

New Zenner

Join Date:
Dec 2008
Posts:
56
Plugin Contributions:
0

Shopzilla Tracking Code Placement?

Hey Everyone!!

I'm just setting up my store https://www.baselinesoftware.com on shopzilla and other comparison shopping sites, and I need some help getting this tracker working correctly. Here is what shopzilla says:

Code Integration

It's easy to add the Shopzilla Performance Tracker to your website, just follow these steps:

  1. Copy the code in the box below.
  2. Paste the code anywhere on your store's receipt page. The receipt page appears after an order is completed, so the Shopzilla Performance Tracker will not interfere with your store's checkout process.
  3. Populate the values in the code. For more information on populating the values in the code, please continue reading after the box.

Tracker Code

<script language="javascript"> <!-- /* Performance Tracking Data */ var mid = '******'; var cust_type = ''; var order_value = ''; var order_id = ''; var units_ordered = ''; //--> </script> <script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script>

The Performance Tracker code allows you to pass five data points back to Shopzilla:

* Your Shopzilla Merchant ID (required)
* The Order Value (strongly recommended)
* The Order ID (recommended)
* Whether the customer is new or repeat (recommended)
* The Number of Units Ordered (optional)

Your Shopzilla Merchant ID has already been added to the code above and does not change. The remaining four values are dynamic and must be populated by code on your site. Your IT department should be able to easily write a script to populate these four variables.

Name: Shopzilla Merchant ID (var MID)
Purpose: Allows Shopzilla to correctly identify the order activity with Baseline Software.
Value to Enter: Your MID is ****** and has been added to the code. DO NOT ALTER the "var mid" value in the code above.
Benefits: Your Merchant ID allows Shopzilla to correctly identify the order activity with Baseline Software.

Name: Order Value (var order_value)
Purpose: Specifies dollar value of an order.
Value to Enter: The total amount of the order without formatting. If the order value is $1,200.38, then populate the "var order_value" with '1200.38'. Do not include dollar signs or commas.
Benefits: Passing Order Value allows you to view Sales Revenue, Average Order Value, and Cost of Sale for Shopzilla-generated sales. This information is necessary to determine which products are driving sales at your store.

Name: Order ID (var order_id)
Purpose: Specifies merchant order identification number associated with an order.
Value to Enter: The unique tracking number associated with an order. It can be numbers, letters, or both.
Benefits:

The Order ID will help should any troubleshooting needs arise but will not be visible in your Shopzilla Performance Report.
Name: Customer Type (var cust_type)
Purpose: Specifies whether the order is from a New or Repeat customer.
Value to Enter:

For a new customer, populate the var cust_type with '1'. For a repeat customer, populate the var cust_type with '0'.

Only a 1 or a 0 is accepted in this field!

For an easy way to tell if a customer is new or repeat, check to see if the customer's email address already exists in your database.
Benefits: Passing Customer Type will allow you to see how many new customers were generated from your Shopzilla campaign and to determine the cost per new customer acquisition.

Name: Units Ordered (var units_ordered)
Purpose: Specifies the number of units of merchandise associated with an order.
Value to Enter: Enter the number of units of merchandise that make up the order. For example, if someone orders a sweater, a shirt and a hat, the units ordered would be 3.
Benefits: This value assists you when performing order value analysis.

You may choose to add the code in the above box "as is" and pass only the Merchant ID, but this will only provide conversion information. We strongly recommend including at least the order value ("var_order_value") so that you can determine your cost of sale. You need to know your cost of sale in order to manage and optimize your campaign effectively.
Performance Tracker Script Example

The code sample below illustrates how the Shopzilla Performance Tracker Script might look after populating all the eligible fields with relevant data from an order. After integrating the Performance Tracker, you should see a similar piece of code when viewing the source code of your receipt page:

<script language="javascript">
<!--
	/* Performance Tracking Data */
	var mid            = '204008';
	var cust_type      = '1';
	var order_value    = '1349.18';
	var order_id       = '928641';
	var units_ordered  = '3';
//-->
</script>
<script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script>

In the example above:

* MID (Merchant ID) is 204008 (this is your Shopzilla MID; never alter this MID!)
* The order value is $1,349.18.
* The order id is 928641
* The order was from a new customer (represented by 1 in the var cust_type field)
* The number of units ordered is 3. 

Does anybody have any idea how I would go about doing this?

26 Aug 2009, 4:41 PM
#2
andy_gs avatar

andy_gs

Zen Follower

Join Date:
Jun 2008
Posts:
187
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Hey all,

right im trying to add our shopzilla tracking code to the checkout success page,

proposed code:

<?php
$cn_orders = "SELECT count( orders_id ) FROM orders WHERE customers_id = '$customer_id'";
$cn_orders_result = $db->Execute($cn_orders);
if $cn_orders_result <= '1'{
$cn_orders_final = '1';
}
else{
$cn_orders_final = '0';
}
?>
<script language="javascript">
<!--
	/* Performance Tracking Data */
	var mid            = '000000';
	var cust_type      = '<?php echo $cn_orders_final ?>';
	var order_value    = '<?php echo round($orders->fields['order_total'], 2); ?>';
	var order_id       = '<?php echo (int)$orders->fields['orders_id']; ?>';
	var units_ordered  = '<?php echo sizeof($order->products); ?>';
//-->
</script>
<script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script> 

I know 'mid' 'order_value' and 'order_id' i know all work as i've tested this.

I'm just trying to sort these last two fields and need a little bit of help.

I need 'cust_type' to display either a '0' or a '1' depending on if they have ordered before. So as i see it the above code should display a 0 if they have ordered 1 time or more, or a 1 if they have never ordered before.

for 'units_ordered' i saw on another post (http://www.zen-cart.com/forum/showthread.php?t=129883&highlight=variable+number+items) that this piece of code should work for displaying number of items:

<?php echo sizeof($order->products); ?>

i basically just want to know if im right about these two things or if the extra bit of php code i added to find number of times the person has ordered is already present on the checkout screen before i implement this.

regards

Andy.

oh dear gurrrddddd.

18 Sep 2010, 12:35 AM
#3
fmckinnon avatar

fmckinnon

New Zenner

Join Date:
Jul 2006
Posts:
84
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Andy,
Looks like it's been a long time since you posted this, and nobody answered - did you get it hashed out? I'm trying to do the same, and would be honored if you'd share the integrated code?

18 Sep 2010, 12:48 AM
#4
fmckinnon avatar

fmckinnon

New Zenner

Join Date:
Jul 2006
Posts:
84
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Coming back ... Andy, I applied the code exactly as given above, and the customer type and units ordered did NOT parse ... see below (taken from the source code of the checkout_success page after I successfully placed an order)

<script language="javascript">
<!-- /* Performance Tracking Data */ var mid = '000000'; var cust_type = ''; var order_value = '26.48'; var order_id = '4638'; var units_ordered = '0'; //--> </script> <script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script>
27 Sep 2010, 3:28 PM
#5
andy_gs avatar

andy_gs

Zen Follower

Join Date:
Jun 2008
Posts:
187
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Hi fmckinnon,

apologies on the delay coming back to you been on 'holiday'.

i had actually completely forgotten about this, so much so i went back into checkout confirmation page and found that i had actually removed it :O.

Apologies if the code i suggested did not give you the outcome you were looking for.

Just been told i need to relook at this anyway so as soon as i come up up with a solution ill update this thread :)

Andy.

oh dear gurrrddddd.

27 Sep 2010, 4:56 PM
#6
andy_gs avatar

andy_gs

Zen Follower

Join Date:
Jun 2008
Posts:
187
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Hey again,

right i think i've done some code that seems to work for me.

<?php 
//Zilla ROI Code
$zilla_oid = (int)$orders->fields['orders_id'];

$cn_orders = "SELECT count( orders_id ) AS zilla FROM orders WHERE customers_id = '" . (int)$_SESSION['customer_id'] . "'"; 
$cn_orders_result = $db->Execute($cn_orders); 


if ($cn_orders_result->fields['zilla'] <= '1'){ 
$cn_orders_final = '1'; 
} 
else{ 
$cn_orders_final = '0'; 
} 

$cn_items = "SELECT count( orders_id ) AS zitems FROM orders_products WHERE orders_id = '" . $zilla_oid ."'"; 
$cn_items_result = $db->Execute($cn_items); 
$zitems =  $cn_items_result->fields['zitems']; 


?> 
<script language="javascript"> 
<!-- 
    /* Performance Tracking Data */ 
    var mid            = '000000'; 
    var cust_type      = '<?php echo $cn_orders_final; ?>'; 
    var order_value    = '<?php echo round($orders->fields['order_total'], 2); ?>'; 
    var order_id       = '<?php echo $zilla_oid; ?>'; 
    var units_ordered  = '<?php echo $zitems; ?>';
//--> 
</script> 
<script language="javascript" src="https://www.shopzilla.com/css/roi_tracker.js"></script> 

I'm not really sure what i was thinking with that code i posted before (brain dead moment).

hope this helps
Andy.

oh dear gurrrddddd.

6 Oct 2010, 9:04 PM
#7
fmckinnon avatar

fmckinnon

New Zenner

Join Date:
Jul 2006
Posts:
84
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Thanks a ton .. I'll try it!

14 Jun 2011, 1:46 PM
#8
basequipment avatar

basequipment

New Zenner

Join Date:
Jun 2011
Posts:
1
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

sartor,
I'm having the same problem. Did you ever figure this out? Also I use Volsion not Zen Cart. But I do beleive that the solution is similar, if not the same. Thanks!

Proudly serving the restaurant supply industry since 1977!

17 Jun 2011, 9:43 AM
#9
kitcorsa avatar

kitcorsa

Totally Zenned

Join Date:
Feb 2007
Posts:
1,724
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

trying to do the same myself...


18 Jun 2011, 5:47 PM
#10
nuin avatar

nuin

New Zenner

Join Date:
Jan 2006
Posts:
6
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Andy_GS,

Tried your fix - but I get an error message:

1146 Table 'cb_zc1.orders' doesn't exist
in:
[SELECT count( zen_orders_id ) AS zilla FROM orders WHERE customers_id = '1']

cb_zc1 is the correct database, however I note that the "orders" table is titled "zen_orders". I am not that good at this? Any ideas how to fix?

Thanks
nuin

24 Jun 2011, 2:44 PM
#11
kitcorsa avatar

kitcorsa

Totally Zenned

Join Date:
Feb 2007
Posts:
1,724
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

this code works for me :-)


2 Sep 2011, 6:26 PM
#12
peterdd avatar

peterdd

New Zenner

Join Date:
Nov 2007
Posts:
21
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

I get the problem as Nuin - an error based around table selection. This appears on the order success page:

1146 Table 'xxxxxxx.orders' doesn't exist
in:
[SELECT count( orders_id ) AS zilla FROM orders WHERE customers_id = '189']

xxxxx is the proper name of the full database. The code isn't selecting the orders table within that database.

Does anyone know the correct code to do that?

It has to be in this part I guess:

$cn_items = "SELECT count( orders_id ) AS zitems FROM orders_products WHERE orders_id = '" . $zilla_oid ."'";
$cn_items_result = $db->Execute($cn_items);
$zitems = $cn_items_result->fields['zitems'];

Any help appreciated.

5 Sep 2011, 8:20 AM
#13
andy_gs avatar

andy_gs

Zen Follower

Join Date:
Jun 2008
Posts:
187
Plugin Contributions:
0

Re: Shopzilla Tracking Code Placement?

Hey all,

@nuin & @peterdd

Do you guys have a table prefix on your zen-cart installation?

@nuin try:

SELECT count( zen_orders_id ) AS zilla FROM zen_orders WHERE customers_id = '1'

@peterdd: do you also have table pre-fixes? - i can't see any in your example but i suspect that you may have?

Andy.

oh dear gurrrddddd.