View Single Post
  #14  
Old 07-27-2006, 08:06 AM
  minorgod's Avatar 
minorgod minorgod is offline
 

X-Adept
  
Join Date: Sep 2002
Location: Arivaca, AZ
Posts: 402
 

Default

You can really place the Overture and Google code anywhere in the order_message.tpl file. Just forget about the <head> tags and just use everything between the <script></script> tags. For example, I have the following code at the very top of my order_message.tpl file with conditional statements so that it is only loaded if we are not in test mode and we are not looking at the printable version. Keep in mind that I'm using the 3.x branch of x-cart, but this should be very similar if not identical to what you would need to do.

Code:
{if $this_is_printable_version eq ""} {include file="location.tpl" last_location=$lng.lbl_order_processed last_url="cart.php"} {* assign a grand_total variable to hold the order total for advanced google conversion tracking by brett *} { if $test_mode != "Y" } {* assign var="grand_total" value="0" *} {literal} <SCRIPT LANGUAGE="JavaScript"> <!-- Overture Services Inc. 07/15/2003 var cc_tagVersion = "1.0"; var cc_accountID = "ABC123-use-your-own-id-here"; 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> {/literal} {/if} {capture name=dialog} <font class=ProductDetails>{$lng.txt_order_placed}</font> <font class=ProductDetails>{$lng.txt_order_placed_msg}</font> {/capture} {include file="dialog.tpl" title=$lng.lbl_confirmation content=$smarty.capture.dialog extra="width=100%"} {/if}

Then just before the closing {/capture} tag on my template, I put the Google Adwords conversion code, so the bottom of my template looks like this:

Code:
{if $test_mode != "Y"} <script language="JavaScript"> <!-- google_conversion_id = useryourownidhere; google_conversion_language = "en_US"; grand_total = {$grand_total}; {literal} if (grand_total) { google_conversion_value = grand_total; } {/literal} google_conversion_label = "Purchase"; --> </script> {literal} <script language="JavaScript" src="https://www.googleadservices.com/pagead/conversion.js"> {/literal} </script> <noscript> <a href="https://services.google.com/sitestats/en_US.html" target=_blank> [img]https://www.googleadservices.com/pagead/conversion/useryourownidhere/?value={$grand_total}&label=Purchase&hl=en[/img] </a> </noscript> {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_invoice content=$smarty.capture.dialog extra="width=100%"}

Also, if you're using cartlab's Google Analytics mod, you could include that in the section that loops over the order items like so:

Code:
{section name=oi loop=$orders} {include file="customer/main/order_message_header.tpl" products=$orders[oi].products giftcerts=$orders[oi].giftcerts userinfo=$orders[oi].userinfo order=$orders[oi].order} {include file="customer/main/order_message_product_data.tpl" products=$orders[oi].products giftcerts=$orders[oi].giftcerts userinfo=$orders[oi].userinfo order=$orders[oi].order} {include file="customer/main/order_message_customer_info.tpl" products=$orders[oi].products giftcerts=$orders[oi].giftcerts userinfo=$orders[oi].userinfo order=$orders[oi].order} {include file="customer/main/order_message_totals.tpl" products=$orders[oi].products giftcerts=$orders[oi].giftcerts userinfo=$orders[oi].userinfo order=$orders[oi].order}<hr size=1 noshade> {if $active_modules.Interneka ne ""} { include file="modules/Interneka/interneka_tags.tpl" } {/if} {*** Google Analytics conversion tracking ***} {if $test_mode != "Y"} {include file="g_analytics.tpl" products=$orders[oi].products order=$orders[oi].order} {/if} {*** END Google Analytics conversion tracking ***} {/section}

Hope that helps.
__________________
www.brettbrewer.com
Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more.
Reply With Quote