AdWords
2.5K members online now
2.5K members online now
Get started with AdWords - learn the basics to get set up for success
Guide Me
star_border
Reply

Conversion Tracking Code in Oscommerce

Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

I tried to add tracking code in a oscommerce thank you page (/checkout_success.php) but the status is still showing - not verified. I made a test order after adding the code, still not showing any conversion. Below is my checkout page code. I am not an expert , so please check and suggest if I added it at correct place or not.

 

<?php
/*
  $Id$

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

  Copyright (c) 2010 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 = '';

    if (isset($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) {
      $notify = $HTTP_POST_VARS['notify'];

      if (!is_array($notify)) {
        $notify = array($notify);
      }

      for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
        if (is_numeric($notify[$i])) {
          $notify_string .= 'notify[]=' . $notify[$i] . '&';
        }
      }

      if (!empty($notify_string)) {
        $notify_string = 'action=notify&' . substr($notify_string, 0, -1);
      }
    }

    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
  }

  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']);
    }
  }

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

<h1><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?>

<div class="contentContainer">
  <div class="contentText">
    <?php echo TEXT_SUCCESS; ?>
  </div>

  <div class="contentText">

<?php
  if ($global['global_product_notifications'] != '1') {
    echo TEXT_NOTIFY_PRODUCTS . '<br /><p class="productsNotifications">';

    $products_displayed = array();
    for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
      if (!in_array($products_array[$i]['id'], $products_displayed)) {
        echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br />';
        $products_displayed[] = $products_array[$i]['id'];
      }
    }

    echo '</p>';
  }

  echo TEXT_SEE_ORDERS . '<br /><br />' . TEXT_CONTACT_STORE_OWNER;
?>

  </div>

  <div class="contentText">
    <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3>
  </div>
<!-- Google Code for Thank you Page Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1014615245;
var google_conversion_language = "en";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "uVOvCNvY3gIQzZnn4wM";
var google_conversion_value = 200;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1014615245/?value=200&amp;label=uVOvCNvY3gIQzZnn4w..."/>
</div>
</noscript>
<!--Google Code end-->
<?php
  if (DOWNLOAD_ENABLED == 'true') {
    include(DIR_WS_MODULES . 'downloads.php');
  }
?>

  <div class="buttonSet">
    <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></span>
  </div>
</div>

</form>

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

 

1 Expert replyverified_user
2 ACCEPTED SOLUTIONS

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by rashu (Google Employee)
September 2015

Re: Conversion Tracking Code in Oscommerce

Top Contributor Alumni
# 2
Top Contributor Alumni

Hi

1. Your code looks good

2. Conversion code update might take up to 24 hrs to actually show up in your account

3. In source of thank you page do you see the conversion code correctly? Please check in detail if its exactly same including CDATA

4. I am assuming you are running ecom store and in which case I would strongly recomend ecommerce tracking code for google analytics to be installed in your website instead of conversion code

You can find out more about ecom tracking here http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55528

There is plenty of help on Oscommerce forums about how to install ecom tracking code and I think there are some extensions also available for the same

Regards

Nik

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

View solution in original post

Marked as Best Answer.
Solution
Accepted by rashu (Google Employee)
September 2015

Re: Conversion Tracking Code in Oscommerce

Google Employee
# 7
Google Employee

Hi anil225 Smiley Happy

 

In relation to your conversion tracking issue it seems that the code is correct, however, it is hard to tell whether it has been implemented in the correct position. The AdWords conversion tracking code usually goes between the body tags (<body> , </body>) in the source code of a webpage - unless of course you have dynamically generated webpages (such as php pages) and then the set-up is slightly different. See this help centre article for more information. 

 

Did the test conversion record for you after you clicked on your AdWords ad in the paid search results? If not, give us a ring on our phone lines (worldwide phone support information) and we would be happy to look into this issue further for you! Smiley Happy

View solution in original post

Marked as Best Answer.
Solution
Accepted by rashu (Google Employee)
September 2015

Re: Conversion Tracking Code in Oscommerce

Top Contributor Alumni
# 2
Top Contributor Alumni

Hi

1. Your code looks good

2. Conversion code update might take up to 24 hrs to actually show up in your account

3. In source of thank you page do you see the conversion code correctly? Please check in detail if its exactly same including CDATA

4. I am assuming you are running ecom store and in which case I would strongly recomend ecommerce tracking code for google analytics to be installed in your website instead of conversion code

You can find out more about ecom tracking here http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55528

There is plenty of help on Oscommerce forums about how to install ecom tracking code and I think there are some extensions also available for the same

Regards

Nik

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Conversion Tracking Code in Oscommerce

Participant ✭ ✭ ✭
# 3
Participant ✭ ✭ ✭

Hi

 

I am not a coder, but I have put the tracking code in several website and seldom had any problem, so I think it is pretty straight forward and you have probably done it correctly.

 

How long is it since you made the test-purchase? Cause it may take up to 24 hours before the conversion is reported in the AdWords-interface.

 

You did click one of your ads before you did the purchase? (personally I forgot that once and scratched my head long before I realised what I forgotten : )

 

 

Re: Conversion Tracking Code in Oscommerce

Top Contributor Alumni
# 4
Top Contributor Alumni

David_Precisera wrote:

Hi

 

I am not a coder, but I have put the tracking code in several website and seldom had any problem, so I think it is pretty straight forward and you have probably done it correctly.

 

How long is it since you made the test-purchase? Cause it may take up to 24 hours before the conversion is reported in the AdWords-interface.

 

You did click one of your ads before you did the purchase? (personally I forgot that once and scratched my head long before I realised what I forgotten : )

 

 


You did click one of your ads before you did the purchase? (personally I forgot that once and scratched my head long before I realised what I forgotten : )

Thats a good one David Smiley Happy I almost forgot about that part

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Conversion Tracking Code in Oscommerce

[ Edited ]
Follower ✭ ✭ ☆
# 5
Follower ✭ ✭ ☆

@David_Precisera.
Thanks for your tips. I just smiled to read " Did you click on your ads"?
Answer NO... didn't click in mind. Smiley Happy
Thanks, I am going to do one more test after clicking my ad and will update it here after 24 hour.

 

@ theniks

My analytic giving me good report of "ecommerce conversion". Few month back I never know that it is so smart that it even calculate if someone use discount coupon and it show the value after disount. Smiley Happy

The above code my be changed after posting here.

Re: Conversion Tracking Code in Oscommerce

Participant ✭ ✭ ✭
# 6
Participant ✭ ✭ ✭
Tip: do a search that you later can recognise in the search term report as yours (for example: keyword TEST) so that you don´t mistake your test-conversion for a real one that easily
Marked as Best Answer.
Solution
Accepted by rashu (Google Employee)
September 2015

Re: Conversion Tracking Code in Oscommerce

Google Employee
# 7
Google Employee

Hi anil225 Smiley Happy

 

In relation to your conversion tracking issue it seems that the code is correct, however, it is hard to tell whether it has been implemented in the correct position. The AdWords conversion tracking code usually goes between the body tags (<body> , </body>) in the source code of a webpage - unless of course you have dynamically generated webpages (such as php pages) and then the set-up is slightly different. See this help centre article for more information. 

 

Did the test conversion record for you after you clicked on your AdWords ad in the paid search results? If not, give us a ring on our phone lines (worldwide phone support information) and we would be happy to look into this issue further for you! Smiley Happy