I wish to use google's new web stat's program with my drupal'd site, but it requires that I link to an external javascript file. Drupal doesn't recongnize the link in my xtemplate. Anybody know a way around this?

David

Comments

gautamg’s picture

in index.php after line

include_once 'includes/common.inc';

I added this line

drupal_set_html_head('< script        src="http://www.google-analytics.com/urchin.js" ty
pe="text/javascript"> </script > < script type="text/javascript"> _uacct = "UA-XXXXX-X"; urchinTracker(); </script>');

change the account number to yours of course and fix the script tags.

--
Gautam Guliani
http://gautam.guliani.net/

daviqh’s picture

Thanks alot, it is in the head, but not the very bottom like Google wants it, and they think it isn't installed. The site is www.mashband.org if you need to see the source. Any help would be accepted. Thanks alot,

David

heine’s picture

The code should go just before </head>.

See http://drupal.org/node/37582

UPDATE:
According to Matt Cutts (Google employee)

Nicky, I think the JS can be included anywhere on the page. I was being safe and putting it exactly where they recommended, but now that I think about this, you could probably put it anywhere.

http://www.mattcutts.com/blog/google-analytics/#comments

--
Tips for posting to the forums

daviqh’s picture

Yes, I know that it needs to be next to the </head>, but however, it is generated from the index.php file where I put the line perscribed above, and it generates into the head of the xtemplate. Embedded javascript doesn't seen to work in the xtemplate, so I wish to know how to put it at the bottom of the head with the index.php .

David