Re: Need help installing Overture Conversion Counter code
Do you know if this would work with X-cart 4.1.x release?
Thanks
-Tuan
Quote:
Originally Posted by minorgod
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>

</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.
|
__________________
Win2003 IIS6, PHP 5.2.3, MySQL 5.0.45 and X-Cart 4.1.9
|