views:

20

answers:

2

Hi,

Basically the issue im having is I have a custom theme, and I need to use $scripts to call the analytics code at the top (the link tracking settings) however this also loads loads of other cr*p js files I dont need or want.

All I want is the analytics stuff the module places in $scripts.

So can I somehow either:

A) Load only the analytics code via $scripts (.info file?) B) Create a new region in .info file (e.g. $analytics) and call that via the template. But then how do I get the analytics code to output to this new region instead of $scripts?

Any help would be most appreciated.

A.

+1  A: 

I would be wary of not outputting $scripts. The files that are output are needed for your other modules to work properly. If you want to reduce the scripts which are output then turn off modules that you don't need.

Jeremy French
+1  A: 

I agree that disabling the $scripts variable (or cleaning it out) will have some "undesired results". I can think of about half a dozen modules that I use on every build that have required js files.

Maybe you should look into the Google Analytic Module which uses the $footer variable instead of the $scripts.

http://drupal.org/project/google_analytics

I also use this module on all my builds as it provides some very easy integration of Drupal into GA including downloads, user roles, etc. (out of the box)

p.s. Remember Drupal has a pretty good Performance settings that allow for the cache as well as consolidation css/js.

My final builds have 1 line of markup that calls ALL of my css for that page and one line that does the same for my js. It's been shown that consolidating your asset files into one large file rather then many small ones is a huge performance saver, more so then the size of the end file itself.

electblake