Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Google Adwords


5 replies to this topic

#1 janetgot

  • Community Member
  • 149 posts
  • Real Name:Janet
  • Gender:Female
  • Location:Boston, MA

Posted 15 July 2005, 20:24

Hi everybody,

I'm working on fine tuning my adwords and want to get the conversion tracking tool working. Right now I have the code on my checkout_success.php page, and it doesn't seem to be tracking anything. Do I have it on the wrong page and can somebody advise what page that should be on?

Thanks! :rolleyes:
Janet

#2 GraphicsGuy

  • Community Member
  • 1,144 posts
  • Real Name:Mike
  • Gender:Male
  • Location:Tennessee

Posted 15 July 2005, 22:31

I have mine in checkout_success.php and it seems to work well.

Here is the code excerpt starting at the end of the body content and going to the end of the file to show the placement I used. This includes both Google and Overture trackers.

Note: Be sure to use the Google and/or Overture code that is generated for your site so that the ID numbers are correct for your site and account.

<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
	<tr>
	<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  <!-- Google Conversion Code -->
 	 <script language="JavaScript">
  <!--
 	 google_conversion_id = ###########;
 	 google_conversion_language = "en_US";
  -->
  </script>
  <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
  </script>
  <noscript>
  <a href="https://services.google.com/sitestats/en_US.html" target=_blank>
 	 <img height=27 width=135 border=0 src="https://www.googleadservices.com/pagead/conversion/############/?hl=en">
  </a>
  </noscript>
	</td>
	</tr>
	<tr>
        <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  <script LANGUAGE="JavaScript">
  <!-- Overture Services Inc. 07/15/2003
  var cc_tagVersion = "1.0";
  var cc_accountID = "###########";
  var cc_marketID =  "0";
  var cc_protocol="http";
  var cc_subdomain = "convctr";
  if(location.protocol == "https:")
  {
       cc_protocol="https";
       cc_subdomain="convctrs";
  }
  var cc_queryStr = "?" + "ver=" + cc_tagVersion + "&aID=" + cc_accountID + "&mkt=" + cc_marketID +"&ref=" + escape(document.referrer);
  var cc_imageUrl = cc_protocol + "://" + cc_subdomain + ".overture.com/images/cc/cc.gif" + cc_queryStr;
  var cc_imageObject = new Image();
  cc_imageObject.src = cc_imageUrl;
  // -->
  </SCRIPT>
	</td>
	</tr>
</table></table>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Rule #1: Without exception, backup your database and files before making any changes to your files or database.
Rule #2: Make sure there are no exceptions to Rule #1.

#3 janetgot

  • Community Member
  • 149 posts
  • Real Name:Janet
  • Gender:Female
  • Location:Boston, MA

Posted 15 July 2005, 23:13

GraphicsGuy, on Jul 15 2005, 05:31 PM, said:

I have mine in checkout_success.php and it seems to work well.

Here is the code excerpt starting at the end of the body content and going to the end of the file to show the placement I used.  This includes both Google and Overture trackers.

Note: Be sure to use the Google and/or Overture code that is generated for your site so that the ID numbers are correct for your site and account.

<{POST_SNAPBACK}>


Thanks so much. I had mine just below the footer tag. I moved it into the body. Still don't see the graphic on the page, but I do see it in the generated code. Will see if the conversions are tracking.

I noticed that your code doesn't put a value on the conversion. My code has:

var google_conversion_format = "1";
var google_conversion_color = "000099";
if (1.0) {
var google_conversion_value = 1.0;
}

and in theory I can put some dynamic code in (maybe final_price?) and it will put the actual cost of the order in the conversion code. If somebody has done this, it would be very helpful to know what the code should be?

Thanks again!
Janet

#4 jeffpolachek

  • Community Member
  • 4 posts
  • Real Name:John Doe Smith

Posted 29 July 2005, 11:16

I'm running OSCMax 2.0 and my checkout_success file looks different than what you guys have in regular OSCommerce. I don't see any body or footer tags (newbie to PHP though). If I add my Google tracking code before the final ?> mark, it breaks the page (nothing will show up to the user). Can anyone suggest how to go about making this work? My file looks like this:


Quote

<?php
/*
  $Id: checkout_success.php,v 1.4 2005/05/14 06:25:19 Michael Sasek Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright © 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

// if the customer is not logged on, redirect them to the shopping cart page
  if (!tep_session_is_registered('customer_id')) {
    tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
  }

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
    $notify_string = 'action=notify&';
    $notify = $HTTP_POST_VARS['notify'];
    if (!is_array($notify)) $notify = array($notify);
    for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
      $notify_string .= 'notify[]=' . $notify[$i] . '&';
    }
    if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

//    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
// Added a check for a Guest checkout and cleared the session - 030411
if (tep_session_is_registered('noaccount')) {
tep_session_destroy();
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'));
}
else {
tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string, 'SSL'));
}
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

  $breadcrumb->add(NAVBAR_TITLE_1);
  $breadcrumb->add(NAVBAR_TITLE_2);

  $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
  $global = tep_db_fetch_array($global_query);

  if ($global['global_product_notifications'] != '1') {
    $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
    $orders = tep_db_fetch_array($orders_query);

    $products_array = array();
    $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
    while ($products = tep_db_fetch_array($products_query)) {
      $products_array[] = array('id' => $products['products_id'],
                                'text' => $products['products_name']);
    }
  }

// PWA:  Added a check for a Guest checkout and cleared the session - 030411 v0.71
if (tep_session_is_registered('noaccount')) {
$order_update = array('purchased_without_account' => '1');
tep_db_perform(TABLE_ORDERS, $order_update, 'update', "orders_id = '".$orders['orders_id']."'");
//  tep_db_query("insert into " . TABLE_ORDERS . " (purchased_without_account) values ('1') where orders_id = '" . (int)$orders['orders_id'] . "'");
tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . tep_db_input($customer_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . tep_db_input($customer_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . tep_db_input($customer_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . tep_db_input($customer_id) . "'");
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . tep_db_input($customer_id) . "'");
tep_session_destroy();
}
  $content = CONTENT_CHECKOUT_SUCCESS;

  include (bts_select('main', $content_template)); // BTSv1.5

  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>


#5 virtualink

  • Community Member
  • 29 posts
  • Real Name:LC
  • Location:Hawaii

Posted 28 September 2005, 11:04

View Postjanetgot, on Jul 15 2005, 01:13 PM, said:

and in theory I can put some dynamic code in (maybe final_price?) and it will put the actual cost of the order in the conversion code. If somebody has done this, it would be very helpful to know what the code should be?

Thanks again!
Janet

Hi Janet,

Were you able to find out what the dynamic code was? If you did, can you please let me know? Thanks!!
Aloha,
Lawrence

#6 virtualink

  • Community Member
  • 29 posts
  • Real Name:LC
  • Location:Hawaii

Posted 28 September 2005, 11:34

View Postjanetgot, on Jul 15 2005, 01:13 PM, said:

and in theory I can put some dynamic code in (maybe final_price?) and it will put the actual cost of the order in the conversion code. If somebody has done this, it would be very helpful to know what the code should be?

Thanks again!
Janet

The fix to add dynamic code to your Google conversion code is located at this post:
Google Conversion Dynamic Code
Aloha,
Lawrence