Support » Your WordPress » Google Analytics

  • I am trying to get the code running for all of my pages. I am using the theme: BlueBlack.

    I know i need to put the google code into the footer before the </body>.

    pbmansion.com/blog

Viewing 13 replies - 1 through 13 (of 13 total)
  • Do me a favor and edit your post and delete all of your code. (You see how bad it all is.) After you do that, repost it with the code within backticks. That;s the key above the tab and to teh left of the ‘1’ key on a standard pc keyboard.

    Thread Starter pbmansioncom

    (@pbmansioncom)

    In the footer i have:

    <div id="footwrap">
    <p><strong>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?></strong> | <a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> and <a href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a></p>
    <a href="http://www.2yi.net" title="Design by Your Index"><img src="<?php bloginfo('template_url'); ?>/img/2YI-logo.png" class="credits" border="none" alt="Your Index Web Directory"/></a><a href="http://wordpress.org" title="Powered by WordPress"><img src="<?php bloginfo('template_url'); ?>/img/wp-logo.png" class="credits" border="none" alt="wordpress logo"/></a>
     </div>
    <?php wp_footer(); ?>

    I have heard you can put it in the header too?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php wp_get_archives('type=monthly&format=link'); ?>
    
    <?php wp_head(); ?>
    </head>
    <body>
    
    <div id="blogtitle">
    <h1><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
    </div>
    <div id="navigation">
    
    	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
    		<fieldset>
    			<input value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
    <input type="image" src="<?php bloginfo('template_url'); ?>/img/search.gif" name="search" alt="Search" class="button" />
    		</fieldset>
    	</form>
    
    	<ul>
    		<li<?php if (is_home()) echo " class=\"selected\""; ?>><a href="<?php bloginfo('url'); ?>">Home</a></li>
    		<?php wp_list_pages('title_li=&depth=1'); ?>
    	</ul>
    
    </div>

    pbmansion.com/blog

    please help

    Well you can try adding it to your theme’s header.php file bit if Google has put it in the end, I’d lean more towards doing it there. It may be looking specifically at one place for it.

    Try adding it right after the:

    <?php wp_head(); ?>

    and before the:

    </head>

    tag.

    Thread Starter pbmansioncom

    (@pbmansioncom)

    Is there a way i can do it in the footer. Because my site will load faster if i do.

    Well I took a look at your site and noticed that after the wp_footer, it outputs the closing body tag. I’d put the script code right after the wp_footer line.

    Thread Starter pbmansioncom

    (@pbmansioncom)

    How do i do this?

    I don’t know exactly what drmike means, but I’d say you’d copy the code you got from Google and paste it in footer.php, just above the line that says </body>.

    Thread Starter pbmansioncom

    (@pbmansioncom)

    look in the copy of my footer in my theme. It doesnt have the </body>

    Thread Starter pbmansioncom

    (@pbmansioncom)

    please help

    I use Google Analytics and I didn’t put it in the footer or header. I put mine AFTER the footer. I use a theme called ‘Dark Ritual’ and it has a “Main Index Template” in the Theme Files and I put the Analytics code right before </body>.

    Does this help?

    (I think most templates have a “Main Index Template” file)

    </body> might also be in index.php.. The location might be different in your theme. Just look in your other template files for </body>. I know one of your template files has a closing body tag, because it’s there when I check out the source code of your site.

    Thread Starter pbmansioncom

    (@pbmansioncom)

    should i just put it anywhere that i see </body>?

    I think that in most themes there’s just one template file with a </body>, but if you have more of them, then you should indeed paste your GA-code above it:

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
    <script type="text/javascript">
      _uacct = "UA-xxxxx-x";
      urchinTracker();
    </script>
    </body>

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Google Analytics’ is closed to new replies.