Need a plug in that will allow you to insert html before the /head tag
and a second that will insert before the /body
This plug in is to make it simple to add the new google analytics code required to be before the /head tag now and for other scripts that require parts in the /head and /body sections.
Comments
The updated Google analytics along with quantcast now uses asynchronous tracking. This seems to be the new standard...
Quantcast actually requires 2 parts of code for this one in the /head and one in the /body
So I was hoping that I could accomplish this with a template edit, but it looks like the way the code is written, a plugin is about he only way to do it. I looked at the TPL folder but it looks like that is not the right route either.
Here is the new Google Code
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-XX']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
so i need to be able to split between the head and body tags...
wow that makes my post hard to read lol
using the code tag <code> before your code and closing it afterI am not the greatest coder in the world
I would highly recommend creating a standard plugin for the head and body sections individually... this will allow for a lot of the requests I see here to be met... things like custom footers that do not touch the original code and using scripts that require a split implementation.
- To add something before the
- To add something before the
Maybe for you, a new plugin would go in the same place as the GoogleAnalytics plugin. To accomplish a clean custom plugin (instead of the hack to the GoogleAnalytics one), you can essentially use GoogleAnalytics as your template. You'd want to store it locally as</head>tag, you can use the existingEndShowHeadElementshook.</body>tag, you can use the existingEndShowScriptshook. This is where you can also add .js, for page load efficiencies and whatnot.local/plugins/Quantcast/QuantcastPlugin.phpor something similar though. And don't forget toaddPluginit in your config.php.Let me know if you need more help.