Results 1 to 10 of 40

Threaded View

  1. #14
    Join Date
    Jul 2007
    Location
    Durham, NC
    Posts
    55
    Plugin Contributions
    1

    Default Re: Google Adwords Conversion Tracking code help.

    I want to thank the contributors to this thread for their pointers on getting Google AdWords conversion to include the dollar value. This is my first post to this forum, which I joined to asked the following:

    I have a couple of remaining concerns about this code. I had to do things my own way, and I wondered why some of the methods shown here didn't work directly. And after getting it to appear in the page source view correctly, it still doesn't display Google's required notification image (imp.gif I think?).

    I'm not sure yet whether it actually reports back to Google, as we don't get conversions every day on this site so I can't yet verify the results in AdWords itself. (I'm reluctant to click and ad and run a test order through the system as that will skew the reporting somewhat, but I may have to if I don't see any conversions in a reasonable amount of time.)

    My first deviation from the examples in this thread was, I was not able to place my conversion snippet into a separate file such as /includes/modules/pages/checkout_success/js_google_code.php. Instead, I inserted the code directly into a template-override copy of the tpl_checkout_success_default.php file itself (includes/templates/<my_template_name>/templates/tpl_checkout_success_default.php).

    Secondly, there seemed to be two different examples shown in this thread, and neither worked for me exactly as given. What I did was to insert code in two places. I placed an SQL call just below the comments at the top of the page before the first ?> to retrieve the order's subtotal value, like so:
    Code:
    ...
     * @version $Id: tpl_checkout_success_default.php 5407 2006-12-27 01:35:37Z drbyte $
     */
    
    // Lookup order subtotal to report to Google AdWords on conversion (see bottom of this code file)
    $orders_query = 'SELECT * FROM orders_total WHERE orders_id = ' . $zv_orders_id . ' AND 
    class = "ot_subtotal"';
    $orders = $db->Execute($orders_query);
    $order_subtotal = $orders->fields['value'];
    
    ?>
    ...
    This of course depends on the ot_subtotal module being turned on in Admin > Modules > Order Total. I placed Google's snippet at the bottom of the file, where it is followed only by the similar Yahoo! Search Marketing snippet. The Google AdWords snippet looks like this:

    ..
    Code:
    .
    <!-- Google AdWords Conversion Code -->
    <script language="JavaScript" type="text/javascript">
    <!--
    var google_conversion_id = <my_conversion_id>;
    var google_conversion_language = "en_US";
    var google_conversion_format = "1";
    var google_conversion_color = "CC6600";
    if (<?php echo $order_subtotal ?>) {
      var google_conversion_value = <?php echo $order_subtotal ?>;
    }
    var google_conversion_label = "purchase";
    //-->
    </script>
    <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<my_conversion_id>/imp.gif?value=<?php echo $order_subtotal ?>&label=purchase&script=0">
    </noscript>
    <!-- End Google AdWords Conversion Code -->
    ...
    I've compared it (using winmerge) against a freshly downloaded snippet from Google, and they are exactly the same. (On Google, I designated https:// from the drop-down, filled in <?php echo $order_subtotal ?> into the field for the value, and refreshed the snippet. That placed the php code for the sub-total field into the correct place in the fresh snippet.)

    I tried wrapping the whole thing in a <p> tag or a <div> tag hoping that would force it to show Google's notification image, but no luck. When I run a test order on my test site (not from an AdWords click), the page source view shows me the sub-total value of the order in the proper places, as below (pasted in from source view, except for conversion id):

    if (4.9900) {
    var google_conversion_value = 4.9900;
    }

    and again:
    HTML Code:
    <img height=1 width=1 border=0 src="https://www.googleadservices.com/pagead/conversion/<my_conversion_id>/imp.gif?value=[B]4.9900[/B]&label=purchase&script=0">
    Any suggestions in my remaining snags? Once again, they are:
    - Have to insert code into template file tpl_checkout_success_default.php, not in its own separate modules/pages/checkout_success/ file.
    - Google's required notification image doesn't appear on screen.
    Last edited by Kim; 20 Jul 2007 at 07:06 PM.

 

 

Similar Threads

  1. v139h Google Analytics Conversion Tracking code install
    By split63 in forum General Questions
    Replies: 7
    Last Post: 17 Dec 2015, 04:09 AM
  2. Adwords conversion tracking
    By SEJ1 in forum General Questions
    Replies: 2
    Last Post: 20 Nov 2009, 06:44 AM
  3. Google Adwords Conversion Tracking - how do I add it?
    By barrystein in forum General Questions
    Replies: 0
    Last Post: 14 Apr 2009, 02:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg