Post to <head>

I am trying to figure out how to post something to a in a specific page, but I cannot get it to work. Specifically I am trying to run a Google Analytics Content Experiment and I need to put the code in the but I do not want it to show for all pages.

use the hooks or and enclose your “data” within a condition based on the controller you want it active for. Why do you want to put it in the 'head'. While I realize this is what most instructions say to do, having the code inside a

$.document.ready( function() { });

will wait till the page loads and then run the code. Gives much faster page loads for the user since the '.ready' method runs asynchronously. Using the above method will allow you to place your code on any page you want by simply using an html block.

The code needs to be between the and , and if it is not then it will not work. Will what you said let me have it in there?

Here is the code I need to add to the



use the scripts hook then (index:scripts).

However, there's nothing special about that code and it will execute from wherever on the page you place it. Since you have a call to the the function, putting it in the head causes it to execute before the page finishes loading.

How do I use the scripts hook to add the code? I cannot find that anywhere.

Like any other hook. Create the file


And add the appropriate code. There is tons of info in the forums here for how to use hooks.