Fix google anlaytics in magento custom template

If you have turned on your google analytics in admin console and you are using custom design template but the google analytics is not showing up in your html codes, look at the below steps to check if the codes are in your custom design are in placed.

1. check page.xml in app\design\frontend\default\[yourtemplate]\layout and verify if the following line is in place.


\\app\design\frontend\default\[yourtemplate]\layout\page.xml

2. open *.phtml in app\design\frontend\default\magikjewellery\template\page and verify if the following line is after the tag


\\app\design\frontend\default\[yourtemplate]\template\page\1column.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\1columnhome.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-left.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-right.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\print.phtml

...

<!--?php echo $this--->getChildHtml('after_body_start') ?&gt;
...

3. clear your cache by going to admin -> system -> cache management and flush magento cache

4. open your home page, right click on it and select view source and check if the following codes are generated.


<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<!&#91;CDATA&#91;
    (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';
        (document.getElementsByTagName('head')&#91;0&#93; || document.getElementsByTagName('body')&#91;0&#93;).appendChild(ga);
    })();

    var _gaq = _gaq || &#91;&#93;;

_gaq.push(&#91;'_setAccount', 'UA-1234567-7'&#93;);
_gaq.push(&#91;'_trackPageview'&#93;);


//&#93;&#93;>
</script>
<!-- END GOOGLE ANALYTICS CODE -->

Related posts

Delete files FAST in Linux

Magento – Get the list of products which customer wanted to be notify when it is back in stock

catalog_product index does not exist yet. Make sure everything is reindexed.