Google Analytics and WordPress

Associate
Joined
22 Oct 2006
Posts
889
Location
Scotland
This is about the 3rd topic I have started in this forum in the past few days, but here I go again :D

Hi, im setting up Google Analytics on my WordPress installation on my site, base07 and Google tells me to paste this code

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

into every web page I want to track, WordPress is php/MySQL and for me this makes it a little awkward. :confused: Where should I put this code? In my WordPress folder inside my ftp account there is an index.php file but inside it it just says...

Code:
<?php
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
?>

So should I put the code there? Im not sure because on my website for.. lets say my "About" page, in the adress bar it says ?page_id=2 but I cant find that file in my ftp to put the code into.

So in short, where should I put the code? :confused:

Thanks in advance ;)
 
Dump it in your themes header file. Above the first bit of php, a la;


<script type=”text/javascript” src=”/wp-content/themes/glossyblue-1-3/scripts/prototype.js”></script>
<script type=”text/javascript” src=”/wp-content/themes/glossyblue-1-3/scripts/effects.js”>


<?php wp_head(); ?>
</head>
<body>
<div id="page">
<div id="header">
<div id="headerimg">
<h1><a href="<?php echo get_settings('home'); ?>/"></a></h1>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
<ul id="nav">
<li class="page_item"><a href="<?php echo get_settings('home'); ?>/" title="Home">Home</a></li>
<?php wp_list_pages('exclude=4,5,6,13,27,35&title_li=' . __('sort_column=menu_order&depth=1&title_li='));?>
<li class="page_item"><a href="http://jtgfx.com/forum/" title="Forum">Forum</a></li>
</ul>
</div>
<!--/header -->

Edit: Note the exclude and then page numbers, this will hide them along your header, but leave them in your sidebar if you feel its too cluttered or whatever. :)
 
No hijack intended but I've got a question:
I seem to have had my Analytics account took off me :confused: I can't log in anymore. Is there anyway to re-register?
 
Ive put it at the begining of my header.php file and uploaded it, google still isnt showing anything up, is there a time delay or am I doing it wrong?


edit

Can someone that knows what they are doing please view my pages source and tell me if the google code is in the right place? Its right at the top so its easy to find, thanks.
 
Last edited:
Its showing in the Script block window, so give it a day or two to collect some stats. :)

The source also looks ok.
 
Back
Top Bottom