I've been invited to the alpha for Measure Map, a pretty statistics system geared towards weblogs and weblog-like sites. They didn't have instructions for Drupal. After a couple of false starts, here's how I added the code to my template, basing it on the WordPress instructions. These instructions are for PHPTemplate-based themes.
- Add the "footer" code to the bottom of your page.tpl.php, somewhere near the <?php print $closure ?> tag. Use the code given to you by MeasureMap, as it includes information specific to your account.
- In the node.tpl.php file, add the following outside of an "if" block (the first if statement in my code should stay there, however, that's how it knows it's the individual item's page: Note that if you have custom node templates, you will need to add the above code there (e.g. node-blog.tpl.php for the 'blog' content type) as well.
- In the comment.tpl.php file of your theme, add the following code outside of an "if" block:<
This should work for Drupal-, CivicSpace- and Bryght-powered websites as long as they use the PHPTemplate theme engine. (Bryght, for whom I work, uses PHPTemplate on all sites.)
I haven't tested it extensively, so let me know in the comments if it doesn't work properly and I'll make the appropriate corrections, both here and in my template.
Thanks for pointing that
Richard — Mon, 2006-01-09 17:31Thanks for pointing that out. I'm more confident that the nodes are getting registered, but can't figure out why comments aren't getting noticed. There's a forum thread where I ask for some help with the comments template.
Thanks for looking into it.
chris — Mon, 2006-01-09 06:03Thanks for looking into it. It now looks more promising, yet I'm still not sure if the new posts and comments are registered. I guess I should wait a day and see if the number goes up.
By the way, you had typed > instead of < in the script for node.tpl.php, right after mmtitle:. (both in the snippet and your actual template) :)
I also updated the code for
Richard — Sun, 2006-01-08 22:34I also updated the code for node.tpl.php which was also missing a 'print' statement.
I did notice that my comment
Richard — Sun, 2006-01-08 22:29I did notice that my comment stats weren't anything but zero. Thanks for pointing it out though. I updated the comments.tpl.php code slightly to include a 'print' statement that was missing.
(With my template updated as well, this comment of mine should theoretically test whether that makes it work.)
I am testing this with
chris — Sun, 2006-01-08 05:59I am testing this with Drupal 4.7 beta 2. The page views seem to be registered, but not the number of new posts and comments. Are you experiencing the same thing? Thanks.