2 replies [Last post]
rickyw's picture
Offline
Joined: 02/02/2009
Juice: 51
Was this information Helpful?

The last post I see is from 2008, so I decided to post a new topic rather than dredge up something so ancient.

Anyhow, I installed the module for google adwords created by KingAndy. Is anyone else using this successfully?
As far as I can see, the tracking code exists on my order complete page, but I still haven't registered a single conversion (which is entirely possible), but I wanted to make sure it wasn't a technical issue.
Upon closer inspection it looks like there is an extra slash being added to the call to the google javascript. Why is that happening? I didn't see any slashes in the module code.
Also, the call to the external javascript seems to occur before the variables are loaded, could that be an issue?
I'm not a coder, so I don't know how it is working specifically. I do know that that line is invoked by a call to a drupal_add_js function. Does this add a slash by default or something?

var google_conversion_id = 1009226217;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "FFFFFF";
var google_conversion_value = 43.51;
var google_conversion_label = "JK62CK_A2AEQ6aOe4QM";

rickyw's picture
Offline
Joined: 02/02/2009
Juice: 51
Re: Google Adwords working?

Don't know if anyone was still interested since there were no responses, but I thought I'd post this anyhow
Anyway, so I figured out that drupal_add_js works relative to the base path of the site, which is why it always put the slash in front of the url, which was preventing the script from working. That is, that drupal_add_js doesn't work well with external scripts.
After trying a number of different things, I found http://drupal.org/node/442930

So basically I copied the drupal_add_js line from that link into the google adwords module and now it will make the right javascript call

essentially I replaced this line:
drupal_add_js($noscript_protocol .'://www.googleadservices.com/pagead/conversion.js', 'module', 'footer');

with these 2:
$conversionjs = url($noscript_protocol .'://www.googleadservices.com/pagead/conversion.js');
drupal_add_js('document.write(unescape("%3Cscript src=\''. $conversionjs . '\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline', 'footer');

hixster's picture
Offline
Joined: 03/26/2009
Juice: 131
Re: Re: Google Adwords working?

Can't you just add a block using the PHP filter with tracking code and show it only on.

checkout/cart/complete