School is a twelve-year jail sentence where bad habits are the only curriculum truly learned.
John Taylor Gatto
New forum topics
Recent comments
- Thanks for the article.
2 weeks 2 days ago - This is because IE is running
2 weeks 2 days ago - The System76 Starling with
3 weeks 18 hours ago - How to name file for theming
4 weeks 2 days ago - "Fatal error: Call to
4 weeks 3 days ago - I put Apache as the front
6 weeks 3 days ago - I'm not using this setup
6 weeks 4 days ago - Nice tutorial.
And how have
6 weeks 4 days ago - Hmm... I tried altering my
7 weeks 20 min ago - I fixed line 35 but still
7 weeks 2 days ago
FeedBurner, the favorite feed management provider of many bloggers has just added site statistics to its StandardStats service.
Now you can use StandardStats to track not only your feed subscribers but your web site audience. But there's a couple of issues with Drupal sites. Let's see how to handle them.
I decided to move from Performancing Metrics after Nick wrote that Metrics had reached an end; it will go the open source route now.
Setting up FeedBurner's StandardStats is quite easy, and it's explained in the link provided above. I'll just focus in the line of Javascript that has to be pasted in your Drupal's theme.
If you use the code as provided by FeedBurner you won't be able to track your site visits correctly. FeedBurner's instructions don't mention it but the code has to go in your node.tpl.php file. If you've created specific files for different node types, like node-forum.tpl.php, you'll need to paste the code there as well.
Then you need to use some PHP to show just one instance of the code in the home page or listing pages, which repeat node.tpl.php many times.
The original code is:
<script src="http://feeds.feedburner.com/~s/YourFeedAddress?i=http://www.example.com<?php print $node_url ?>" type="text/javascript" charset="utf-8"></script>
You should use that piece of code inside the block that starts with:
<?php if ($page != 0) { ?>
which is the one working when you visit a node's page.
Then to the home and listing pages. I inserted the following code in node.tpl.php:
<?php if ($id == 1 && $page == 0) { ?>
<script src="http://feeds.feedburner.com/~s/YourFeedAddress?i=http://www.example.com/" type="text/javascript" charset="utf-8"></script>
<?php } ?>
after this line:
<?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php }; ?>
That way I make sure the code appears only for the first of the many nodes listed.
It's just a start and I'm sure the code can be improved but there you have it, the all new FeedBurner StandardStats running with your Drupal site and tracking all your pages correctly.


Join the conversation
added a block to content area instead.
I added the code in a block instead of the template. I keep it out of admin, node add/edit pages etc. using the block admin interface.
Used REQUEST_URI instead of node_url as in the feedburner site example. Seems to work OK so far.
<script src="http://feeds.feedburner.com/~s/YourFeedAddress?i=http://www.example.com<?php print $_SERVER['REQUEST_URI'] ?>" type="text/javascript" charset="utf-8"></script>REQUEST_URI may display different info depending on your server. But it works in my lighttpd setup.
Joe
How do I check if it works?
I've tried to setup feedsburner stats with drupal with the changes to node.tpl.php file in the /themes/engines/phptemplate/ directory.
How do I check if it's working? Do I've to wait till I see stats in Feedburner or are there other ways of checking.
Regards,
Stefan Stranger
Just take a look at your FeedBurner account
It takes an average of 24 hours to see the data on your dashboard.
Alexis Bellido
Only subscriber info
I only get subscriber info on my dashboard. I don't get any site stats. What could be wrong?
Regards,
Stefan Stranger
Drupal FeedBurner module
Just wanted to let everyone reading this know that I've been working on a Drupal FeedBurner module (http://drupal.org/project/feedburner) that helps with feed redirection and also helps with FeedFlare/StandardStats/Ad Network insertion.
FeedBurner is doing great.
FeedBurner is doing great. It will be even better as it's now a part of Google.