Is this analytics code in the right place?

2 replies
  • WEB DESIGN
  • |
My code doesn't seem to be working, I'm using wordpress the code for the header is:

<!DOCTYPE html><!-- HTML 5 -->
<html <?php language_attributes(); ?>>

<head>
<meta name="google-site-verification" content="EJlgma9J1Sx-bFAT7FO1MhOig9Noy4K7xg3JOuyHKBc" />
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<title><?php bloginfo('name'); if(is_home() || is_front_page()) { echo ' - '; bloginfo('description'); } else { wp_title(); } ?></title>

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23656785-1']);
_gaq.push(['_trackPageview']);

(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';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

</head>

<body <?php body_class(); ?>>
<div id="wrapper">

<div id="header">

<div id="head">
<div id="logo">
<?php
$options = get_option('themezee_options');
if ( isset($options['themeZee_logo']) and $options['themeZee_logo'] <> "" ) { ?>
<a href="<?php echo home_url(); ?>"><img src="<?php echo esc_url($options['themeZee_logo']); ?>" alt="Logo" /></a>
<?php } else { ?>
<a href="<?php echo home_url(); ?>/"><h1><?php bloginfo('name'); ?></h1></a>
<?php } ?>
</div>
<div id="topnavi">
<?php
// Get Top Navigation out of Theme Options
wp_nav_menu(array('theme_location' => 'top_navi', 'container' => false, 'echo' => true, 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 0));
?>
</div>
</div>
</div>

<div id="wrap">
<div id="navi">
<?php
// Get Main Navigation out of Theme Options
wp_nav_menu(array('theme_location' => 'main_navi', 'container' => false, 'echo' => true, 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 0));
?>
</div>
<div class="clear"></div>

<?php if( get_header_image() != '' ) : ?>
<div id="custom_header">
<img src="<?php echo get_header_image(); ?>" />
</div>
<?php endif; ?>

The analytics code is in bold
#analytics #code #place
  • Profile picture of the author jamesg3
    yes it is... but you normally have to wait for 12 tyo 36 hours to see anything in your GA dashboard.
    Signature
    Serious Wordpress sites, html/css sites and flash sites Cheap. I provide killer SEO, easy to use e-commerce solutions and payment gateways. Check me out at Serious Website Design.
    Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
    {{ DiscussionBoard.errors[3978116].message }}
    • Profile picture of the author Lloyd Buchinski
      Just in case it is any more assurance, james is right. Just before the /head tag is where Google now recommends putting the code.

      I still have sites with the code before the /body tag and it works fine there too. Where you put it doesn't seem to make much difference.
      Signature

      Do something spectacular; be fulfilled. Then you can be your own hero. Prem Rawat

      The KimW WSO

      {{ DiscussionBoard.errors[3979464].message }}

Trending Topics