View Single Post
  #9  
Old 04-02-2004, 12:55 PM
  minorgod's Avatar 
minorgod minorgod is offline
 

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

Default Track both Google and Overture

I don't think it matters where you put the Overture code. From looking at the code, it should work anywhere in your order_message.tpl. I have gotten both Overture and advanced Google conversion code. It has been working fine for us within the body of the page. Here's what my order_message.tpl looks like, but keep in mind this is from X-Cart 3.3.x branch and I have taken the liberty of removing our tracking IDs from this code and replaced with "your_tracking_id_here":

Code:
{* $Id: order_message.tpl,v 1.18 2002/10/17 13:54:56 zorg Exp $ *} {* assign a grand_total variable to hold the order total for advanced google conversion tracking by brett *} {assign var="grand_total" value="0"} {literal} <SCRIPT LANGUAGE="JavaScript"> <!-- Overture Services Inc. 07/15/2003 var cc_tagVersion = "1.0"; var cc_accountID = "your_tracking_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} {include file="location.tpl" last_location=$lng.lbl_order_processed last_url="cart.php"} {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%"} {capture name=dialog} {section name=oi loop=$orders} <pre> <font> {include file="mail/order_invoice.tpl" products=$orders[oi].products giftcerts=$orders[oi].giftcerts userinfo=$orders[oi].userinfo order=$orders[oi].order} </font> </pre> <hr size=1 noshade> {assign var="temp_order" value="$orders[oi].order} {assign var="grand_total" value=$temp_order[total]+$grand_total} {/section} <script language="JavaScript"> <!-- google_conversion_id = your_tracking_id_here; 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/1234567890/?value={$grand_total}&label=Purchase&hl=en[/img] </a> </noscript> {/capture} {include file="dialog.tpl" title=$lng.lbl_invoice content=$smarty.capture.dialog extra="width=100%"}

For overture, I just pasted the code inside some literals. For Google, I'm just doing a loop throught the orders and totaling them with Smarty, then substituting the $grand_total into the Google Javascript code. This way you can track the actual value of each conversion in Google. I just upgraded to this advanced tracking today, so the code isn't tested yet, but it should work fine.
__________________
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