I just got my Adsense code and need to paste the code into the HTML of the website right after the <head> tag.

I couldn't figure out it. Can you please explain to me where to paste it in Magento?

  • My suggestion is to stop placing all these snippets and use google tag manager.
    – ProxiBlue
    Oct 5, 2016 at 5:47

2 Answers 2


it depend on where you want to put that code you can put in layout file if you want to put it on product page or somewhere else.

The easiest is using CMS blocks, this is a very simple approach however there are other ways.

If you create the following file

app/design/frontend/default/yourwebsite/layout/local.xml and add the code below, in admin you then need to set Configuration > General > Design > Themes > Default

to yourwebsite or whatever you name the your folder as above.

<?xml version="1.0"?><layout version="0.1.0">    <default>        <reference name="right">            <block type="cms/block" name="right.static">                <action method="setBlockId"><block_id>right_static</block_id></action>            </block>        </reference>    </default></layout>

Create a new CMS static block called right_static and paste your adsense code, clear your cache and you should see the ads immediately. Adsense initially places blank images if it is a new account so you should check the source html in the browser if it is not showing.


you can simply past ads code trough admin panel by system->configuration->design->header or footer section where you want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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