X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Need help installing Overture Conversion Counter code (https://forum.x-cart.com/showthread.php?t=6749)

enge919 03-17-2004 10:28 PM

Need help installing Overture Conversion Counter code
 
I have signed up for the Overture Conversion Counter and it requires adding a little JavaScript code in between the <head></head> tags, simple enough? The only place I know to add it is in the customer/home.tpl with the rest of my JS but it needs to be on the order confirmation page only.

Here is the JS code:
Code:

<SCRIPT LANGUAGE="JavaScript">
<!-- Overture Services Inc. 07/15/2003
var cc_tagVersion = "1.0";
var cc_accountID = "xxxxxxxxxx";
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>


And the instructions they sent:
Code:

The tag must be placed on the transaction completion page of
your Website. The tag must not be modified. Modification of the Overture tag will result in malfunction of the tag, including data loss or inaccurate collection of data.

WHERE TO INSERT YOUR TAG
To properly track a conversion, OvertureБ─≥s tagging technology must be placed on the transaction completion page. If the tag is placed on any other page, your conversion counts could be overstated.

The Overture tag must be placed within the header of the HTML document between the <HEAD> (open header) and </HEAD> (close header) tags.

Example of a basic HTML document using recommended tagging method

<html>
<head>
<title>Sample HTML File</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Overture Services Inc. 03/01/2003
var ov_tagVersion = "1.0.0";
var ov_accountID = "XXXX";
var ov_queryStr = "?" + "tv=" + ov_tagVersion + "&ai=" +
ov_accountID + "&rf=" + escape(document.referrer);
var ov_convImage = new Image();
ov_convImage.src = "//oa.overture.com/Conversion.gif" +
ov_queryStr;
// -->
</SCRIPT>
</head>
<body>
This is the content of your web page.
</body>
</html>


HYPERTEXT PREPROCESSOR (PHP) SET UP INSTRUCTIONS
OVERVIEW

This section describes how to use PHP to get the tag written into your confirmation or thank you page. You will need to save the JavaScript code provided at signup time (or retrieved from DTC) to a file on your webserver and then include a small amount of PHP script in the
HEAD section of your html.


INSTRUCTIONS

Step 1
Save the JavaScript provided to you as a file, in this example Б─°overture_cc.jsБ─²

Step 2
Place this file on your webserver, in a location of your choice, for example
Б─°/javascript/overture_cc.jsБ─²

Step 3
Edit your confirmation or thank you page to include the following PHP script

<?PHP
$filename = Б─°javascript/overture_cc.jsБ─²;
$fp = fopen($filename,Б─≥rБ─≥);
if ($fp) {
$js = fread($fp,filesize($filename));
echo($js);
fclose($fp);
}
<?>

Important
The value supplied to the filename variable in the script shown above is dependent on threeitems:

1) what you named the JavaScript file supplied to you by Overture
2) where you place the JavaScript file supplied to you by Overture
3) The location of the JavaScript file relative to the location of your confirmation or thank you page template.

As shown in the above example, there is a directory or folder named Б─°javascriptБ─² that is in the same directory as the confirmation or thank you page, and inside that folder there is a file named overture_cc.js. Please consult your webmaster if you are not sure of how to implement this approach.




Any help with this is much appreciated!

The site this is going on is x-cart 3.4.11

shan 03-18-2004 03:46 AM

make sure you wrap the java code in literal tags

{literal} java code {/literal}

enge919 03-19-2004 12:47 AM

Where, or how could I put the code so it is placed in between the <head></head> tags on the confirmation page only?

As the instruction say, it needs to be on the confirmation page only or else it will reports inaccurate information.

Could this maybe be done with a include in the .php file? and is there and easy way to do this?

Thanks!

bcr 03-20-2004 07:57 PM

I would think you would put it in the main/order_message.tpl file. Something like this:

Code:

{literal}
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Overture Services Inc. 07/15/2003
var cc_tagVersion = "1.0";
var cc_accountID = "xxxxxxxxxx";
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>
</head>
{/literal}


enge919 03-22-2004 10:07 PM

wouldn't this just be adding Head tags to this template essentially putting in 2 sets of Head tags on the final outputed page that the customer sees?

eleven 03-25-2004 06:07 AM

That didn't work
 
I didn't think that having two <Head> sections would work. I tried it earlier this week but it didn't work. Google's conversion code worked on that page though.

I don't know if this will work, but this is what I did. In skin/customer/home.tpl in inserted the following code right above the closing </head> tag.
Code:

{if $main eq "order_message"}
        {literal}
        <SCRIPT LANGUAGE="JavaScript">
        var cc_tagVersion = "1.0";
        var cc_accountID = "111111";
        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}


Thoughts? Does anyone have another way?

enge919 03-25-2004 10:12 AM

eleven...
This is about what I was thinking, I have put the code in and will be testing it a little later today. I will post the results when i'm done...

Thanks for the assist!

blue-dreamer 04-01-2004 08:11 AM

Any update on this one? I've got a customer who's just signed up for Overture...

minorgod 04-02-2004 12:55 PM

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.

enterfusion 02-22-2005 04:35 PM

Placed in the home.tpl would give you incorrect results...
 
If you place this code in the home.tpl your conversions would be way off, since everything calls that tpl file, you need to place it in the order_message.tpl file, but I have not gotten it to give me any results there, even though I have no javascript errors and it DOES show up in the source on that page, anyone have any ideas?

-Eric

Running X-cart 3.5.5
www.chirunning.com


All times are GMT -8. The time now is 09:44 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.