richardSD Posted January 29, 2011 Share Posted January 29, 2011 Hi, I am using a third party data feed service to service a bunch of shopping comparison sites. While the service offers a good array of analytics, I need to incorporate some code into my oscommerce pages. I also need to add a variable into the analytics code. This variable is the 'order total value'. The data feed service states: Set the order total value in order to track revenue from conversions. You must assign the order total value from your shopping cart platform to GoDataFeed's order total variable; this is the Javascript variable gdf_orderTotal that is found in the conversion scripts. The variable assignment should be in string format, without currency symbols. Here is the javascript I am to paste into the pages for conversion tracking: <!-- GoDataFeed code for conversion page --> <script language="javascript" type="text/javascript">var gdf_orderTotal = '0.00';</script> <script language="javascript" type="text/javascript" src="https://tracking.godatafeed.com/gdf_conversion.js"></script> Can anyone assist me by providing me with the value that comes from OsCommerce? Thanks Richard Link to comment Share on other sites More sharing options...
Guest Posted January 30, 2011 Share Posted January 30, 2011 If the order has already been processed, then this code should get you started: <?php $orderId = setTheOrderId;//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< replace this with the order id variable!! $fields = 'value'; $filter = sprintf("orders_id = '%s' AND class = '%s'", $orderId, 'ot_total'); $order = '1 asc'; $select_sql = sprintf("select %s from %s where %s order by %s" , $fields, TABLE_ORDERS_TOTAL, $filter, $order); $select_query = tep_db_query($select_sql); $total = 0.0; while($row = tep_db_fetch_array($select_query)){ $total = $row['value']; } ?> <!-- GoDataFeed code for conversion page --> <script language="javascript" type="text/javascript">var gdf_orderTotal = '<?php echo $total; ?>';</script> <script language="javascript" type="text/javascript" src="https://tracking.godatafeed.com/gdf_conversion.js"></script> Let me know if it (doesn't) work(s)... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.