AdWords Conversion Code Problem in Sitewide Footer

Status
Not open for further replies.

BrianL

I know nothing
Nov 27, 2006
147
6
0
Arizona
Here's what I'm trying to do:

I'm setting up an AdWords campaign that lands on my site (which I have full control of). People end up searching and landing on a merchant site. I can only control the footer site-wide on the merchant's site (html or javascript only), but the conversion doesn't actually happen until 3-4 pages deep through a booking form. I need to put the AdWords conversion code in the footer and have it only trigger if the user makes it to a page with confirm.php in the URL. Here's what I came up with, but it triggers the conversion as soon as the user lands on the merchant site.

Code:
<!-- Google Code for purchase Conversion Page -->
<script language="JavaScript" type="text/javascript">
<!--
if(document.URL.indexOf('confirm.php')){
 var google_conversion_id = XXXXXXXXX;
 var google_conversion_language = "en_US";
 var google_conversion_format = "2";
 var google_conversion_color = "FFFFFF";
 if (0.0) {
   var google_conversion_value = 0.0;
 }
var google_conversion_label = "purchase";
document.write('<script language="JavaScript" src=" https://www.googleadservices.com/pagead/conversion.js">');
document.write('<noscript>');
document.write('<img height=1 width=1 border=0 src=" https://www.googleadservices.com/pagead/conversion/XXXXXXXXX/imp.gif?value=0.0&label=purchase&script=0">');
document.write('</noscript>');
}
//-->
</script>
Any ideas?
 


Status
Not open for further replies.