ThemeShaper Forums » Thematic


google analytics code in child theme?

(3 posts)
  • Started 11 years ago by stevewynn
  • Latest reply from Caramboo
  • This topic is not resolved
  1. stevewynn

    Sorry, Im quite new at this so please bear with me. Sorry if this is obvious, but i just want to make sure i am doing everything correctly.

    Im trying to add the google analytics code to my footer.php in my Thematic setup.

    I am using the child theme Earlymorning. As i understand I should inject the google analytics code in the child theme's footer.php.

    Is this correct?

    </div><!-- #main -->
        // action hook for placing content above the footer
    	<div id="footer">
            // action hook creating the footer
    	</div><!-- #footer -->
        // actio hook for placing content below the footer
    </div><!-- #wrapper .hfeed -->
    // calling WordPress' footer action hook
    // action hook for placing content before closing the BODY tag
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("XXXXX");
    } catch(err) {}</script>
    Posted 11 years ago #
  2. I've just been using the "google analytics for wordpress" plugin, which does this automatically..

    Posted 11 years ago #
  3. Caramboo

    Put this in your functions.php file:

    function analytic_footer() {?>
    <script src="" type="text/javascript">
    <script type="text/javascript">
    _uacct = "UA-1234567-2";
    <? }
    add_filter ('thematic_after', 'analytic_footer');

    Obviously replace the 1234567...

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.