I am developing a few modules for Magento. In one of them, I need to attach a javascript piece of code at the end (or at the head) of each page. The code works more or less like google analytics (but my module is much simpler than the mage/googleanalytics one). Which event should I use to correctly inject the javascript code to the page source code that is being viewed?


you can paste your javascript code in some javascript file.lets call somejs.js and place this js file in your theme's js folder under skin directory.

now in your themes local.xml (if not present create it) and paste include that js file here like

<?xml version="1.0" encoding="UTF-8" ?>
        <reference name="head">
            <action method="addItem">
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.