How to setup FeedBurner Stats on Drupal
I just setup FeedBurner Stats tracking code on this blog and had a few problems with the Drupal code that FeedBurner supplies. The main problem is that it doesn't get the proper page URL when put into a block.
Putting javascript tracking codes in blocks has a number of benefits, the main ones being that you can use the block visibility settings to show it only for specific user roles (eg - not site administrators).
The code that Feedburner provide is:
This code will work properly if placed in the Node.tpl.php file in your theme directory - which isn't a great option because
- It's hard to limit the roles that are tracked and
- It will only show on node pages and not any other system pages or views
- Not everyone has access to the theme files and wants to mess around with them
Here is the modified code that will work when placed in a block.
The code is by no means perfect but it does the job. If you are not using clean URLs (who isn't these days) you may want to add ?q= after yoursite.com/ otherwise the URLs in FeedBurner Stats won't match up correctly to the URLs on your site.
Comments
'Widgets'
I created a content type 'widgets'. I then created a feedburner widget, and a statcounter widget and a google analytics widget. Then I created a View for this content type and provided a block. That block is then only displayed for unauthenticated and non-admin roles.
Beneficial post
http://www.bookreviewsarticles.info
Your website is very chatty. It will be useful for all of us. You have done a work. I will come here again to check new updates. Thanks for posting.
superb post
I have visited to this site many times and everytime I find useful jobs for me so I would suggest please come to this site and take the chance from here.
Addendum to previous
Addendum to previous comment: Which means I've obviously not really been looking at my stats in detail to see that I'm missing a lot of information.
url function
This type of functionality is exactly what the url() function is for. This would eliminate the clean url's issue, and also let you track the aliased path rather than the standard drupal path.
Here's the updated code:
<script src="http://feeds.feedburner.com/~s/yourfeedburnername?i=<?php print url($_GET['q'], NULL, NULL, TRUE) ?>" type="text/javascript" charset="utf-8"></script>
The additional arguments for the url parameter are necessary so that the url printed will be absolute.
FeedBurner module
Or use the excellent FeedBurner module: http://drupal.org/project/feedburner
CD Manufacturing
Interesting article. All tips are good
Interesting article. All tips
Interesting article. All tips are good.I agree that your code would be more suitable.
Great post
Yes very nice post . thanks for sharing with us .
Your style is so unique in
Your style is so unique in comparison to other people I’ve read stuff from. I appreciate you for posting when you have the opportunity, Guess I will just bookmark this blog.
Tremendous things here. I’m
Tremendous things here. I’m very glad to see your article. Thanks so much and I’m looking forward to contact you. Will you please drop me a mail?




