80 How To Add Star Ratings to your Blogger Blog
July 03, 2008 /

Star ratings is a new feature currently available through Blogger in Draft. This enables you to add a widget beneath your posts which readers can use to rate your articles on a scale of 1-5, like this:

If you use a default Blogger template, you should be able to activate this feature right away when logged through Blogger in Draft: simply go to Layout>Page Elements and edit the "Blog Posts" widget to activate the display.

However, those using a customized or third party template will need to add the required code to their templates first. In this tutorial, I'll explain how you can add "star-rating" functionality to your customized Blogger template.


To use the "star ratings" feature, you will first need to activate this through Blogger in Draft (it's still in beta, and not yet available for use in the regular Blogger dashboard).

Log into Blogger in Draft and  choose the blog you wish to work with. Then go to Layout>Page Elements, and click the "Edit" link on the "Blog posts" widget.

This screen offers many options for you to add (or remove) from the posts section of your blog. If you scroll down a little, you'll see the "star ratings" option. Tick this option to activate this setting for your blog, then scroll down to save your settings.

If you are using a default template, you should see the star ratings widget appear on the post pages of your blog. However, if you have customized your template (or are using a third party template), it is likely that your template does not include the code required to make the star ratings display.

Here is how you can add the required code for star ratings to your non-standard Blogger template



  1. Go to the Edit HTML page in your blog's dashboard, and ensure you have checked the "expand widget templates" box.
  2. Using your browser's search function, try to find this line of code:
    <div class='post-footer-line post-footer-line-1'>
    If you cannot locate this, search for the following instead:
    <p><data:post.body /></p> 
  3. Immediately after this line (either the post-footer or post.body), add the following section of code:
    <b:if cond='data:blog.pageType == &quot;item&quot;'>

    <span class='star-ratings'>
    <b:if cond='data:top.showStars'>
    <div expr:g:background-color='data:backgroundColor' expr:g:text-color='data:textColor' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>
    </b:if>
    </span>

    </b:if>
  4. Next, find this line in your Blogger template (this should be a little further down):
    <b:include name='nextprev'/>
  5. Just after this line, paste the following section of code:
    <b:if cond='data:top.showStars'>
    <script src='http://www.google.com/jsapi' type='text/javascript'/>
    <script type='text/javascript'>
    google.load("annotations", "1");
    function initialize() {
    google.annotations.createAll();
    google.annotations.fetch();
    }
    google.setOnLoadCallback(initialize);
    </script>
    </b:if>
  6. Then save your template.

Now when you view a post page on your blog, you should see the star ratings appear beneath your posts!

Anurag Bansal has posted a similar tutorial on his blog, Knowliz. If you have any problems with this version, I'd advise you to check out this page instead (thanks for the comment and info, Anurag!).

If you would prefer the star ratings to appear on all pages of your blog, you can remove the lines which include the <b:if> tags. These lines tell Blogger to display the star ratings only on your post pages; removing them enables them to be displayed on all pages of your blog (take a look at this post for more information about the b:if function).

I hope this tutorial will help you understand how to apply the star-ratings function on your Blogger powered blogs! Please let me know what you think about this post by leaving your comments below.

80 Comments:

3 July 2008 19:17 Anurag Bansal said...

Hi Amanda,
In your previous post about Embedding Comment form, I left a comment with the link to my post explaining the same thing. Here is the link again:
http://www.knowliz.com/2008/07/how-to-add-star-rating-to-custom.html
Thanks for providing the information to a wider audience you have.

3 July 2008 19:23 Anurag Bansal said...
This post has been removed by the author.
3 July 2008 19:44 Floyd said...

Doesn't work for me :(

3 July 2008 22:14 stampin_melissa said...

Thanks for posting this info! I use the blogger template and had no problem figuring out how to turn on this feature, (with your help of course!)

4 July 2008 00:57
David Aragon said...

Doesnt work for my blogger either, I wont even bother to ask you anything, last time I left a comment here about the in-line comment you didnt answer me.

If it wanst for this other guy that followed my comment and went to my blog, I would still be helpless.

Thanx for nothing!

4 July 2008 01:58
Robert Hache said...

Doesn't work for me!

4 July 2008 05:37 Kaustubh Moghe said...

Thank you the post.
Worth a try.

4 July 2008 06:44 Tran Tinh said...

It does not work for me too.

http://vietblogviet.blogspot.com

4 July 2008 09:59 Andy said...

It does not work for me. I ticked "star ratings" option and saw no change to my blog. I then changed the code for star ratings and again nothing happened.

4 July 2008 10:21 Amanda said...

I'm truly sorry for the problems some of you have experienced using this method. When I reviewed my method, I realized that I'd forgotten to add an important section of code to the tutorial!

The post is now updated to include all necessary code. I've just tried this out in three different customized templates to ensure it works as planned.

Hope this update will help solve the problems and enable you all to display the star ratings :)

4 July 2008 10:26 Crissy said...

it worked for my blog but it appears twice.

4 July 2008 10:30 DarkUFO said...

Thanks Amanda,

Great stuff as always and working fine on my test blogs.

4 July 2008 11:56 Tran Tinh said...

It works now but the color does not match with background, how can I do it now? Thanks

4 July 2008 19:57 António Amorim said...

Hi! Hi have the same problem as tran tinh! Any help? Thanks!

5 July 2008 01:26 António Amorim said...

If this help:
I noticed that star rating uses the bgcolor/mainbgcolor variables. But my template don't have any variables section! I don't know why!!!
How can I change it?!?
Thanks ;)

5 July 2008 02:37
Aneesh said...

Use this sort of code <div g:background-color='#ffffff' g:text-color='#ffffff' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/> instead of

<div expr:g:background-color='data:backgroundColor' expr:g:text-color='data:textColor' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>

You should replace #ffffff with appropriate color codes..

5 July 2008 05:26 Cush said...
This post has been removed by the author.
5 July 2008 06:51 Cush said...

Hi Amanda, thanks for that its great.

I am trying to remove the bif lines so i can see the star rating on any post or page. However when i remove them i get the message the div needs to be closed properly but i cant see where. Any suggestions anyone? Thanks

5 July 2008 07:59 Loey said...

i also facing the same problem like crissy, it appears twice!

5 July 2008 08:55 António Amorim said...

Thank you sooo much Aneesh!!! I solved the problem!
Dear Amanda, I think you should add this tip too in this tutorial!!
Thanks again for the support...

5 July 2008 13:24
Anonymous said...

I got the double too, but if you go back into the html and make sure there is only one copy it works.

5 July 2008 15:06 Halim-Belajar SEO said...

I think this is a great ways to know our popular pages by checking it star. Thanks for tips.

5 July 2008 20:05 António Amorim said...

Oh... Now I have another problem! Whwn I put that code i get like a white box around the star rating, i tried to decrease the size the size in "g:height='42' g:type='RatingPanel' g:width='180'/>", but when it's good in firefox it's wrong in IE!! Any help?
Thanks

5 July 2008 22:47 Anurag Bansal said...

Thanks Amanda for including my blog link.
After reading couple of comments above, I realized lot of user are experiencing background color issue which is white by default.
If any of you want to sort out that issue, drop at my blog and leave a comment on any post or the post Amanda mentioned above, I would be very happy to help.
Generally people with custom background URLs are facing this issue.
Thanks
Anurag Bansal

6 July 2008 06:32 Julian Schoffel said...

I wonder if Google intends to use these star ratings in their Search Engine rankings? I would hazard a guess that they will - it makes perfect sense, so long as people don't exploit them.

6 July 2008 08:49 Clement Yonathan said...

WOW... Horay! I managed to install Comment Box and Star Rating. Thanks to you bro! Success

wanna see: http://freeinternetmarketingresources.com

6 July 2008 09:03 Clement Yonathan said...

Sorry... not bro but Sis :)

I didn't noticed till I saw the author.
Looking forward your hundred tips to blogging world since I'm newbie.

ASk your permission to put your link on my blog to this useful article and some other articles that can benefit my blog reader in the future???

Success

6 July 2008 23:29
Miqui said...

Still doesn't work on mine

7 July 2008 01:07 Lets Go Hawks!! said...

Sorry Amanda, doesn't work in mine either. I've always had success with your tutorials also, so I know I've done everything correct. Will keep trying though!

7 July 2008 10:56 Mr. magicball said...

I followed your instructions and checked the other posts mentioned, but unfortunately Blogger replies with: bX-vxhwro...

Thanks for your time and effort, but it seems to be that Google will need again some years to let this function.

7 July 2008 14:50 Julian Schoffel said...

Following Amanda's instructions I managed to get the star ratings working on all of my blogs:

http://www.growlingdoggames.com
http://www.thebeginnersbloggingguide.com
http://www.theparanormalblogsite.com

You can see them in the post pages only.

I would suggest that the reason some people are having problems is because they aren't going into Blogger Draft and enabling the star ratings in the Blogger Draft post layouts page...

Just a guess, otherwise I can't see why it wouldn't work.

7 July 2008 14:53 zizukabi said...

Thanks Amanda.
This post help me more.
So I translated this post into Korean as 별 등급 보기 Star Ratings.

7 July 2008 16:49 AN7ONYO said...

Thanks to Anurag Bansal my star rating is fully working! You can see it in www.loltuga.info!

9 July 2008 08:36 Warrior In Scrubs said...

Zizukabi:

Sorry man, but I just thought what you said was very funny. :p

9 July 2008 18:11 sarv007 said...

i am able to add the star rating but , it is appearing above the post and below the post title.........how to place it below the post
i use template by blogger buster......
www.sarv007.blogspot.com

17 July 2008 03:40 PAPA MOUSSA said...

how can find the codesearching in my brownser

17 July 2008 16:03 Brian said...

Worked after I manually added the lines of code. Checking the box didn't work for some reason. Thanks Amanda!

19 July 2008 19:30 Lets Go Hawks!! said...

I finally got mine to work, but like the many others here and at Knowliz's site, I am also having problems with the background color. It's fine if you have a white background, but mine is black. So I found this great rating code at http://js-kit.com/ ,it's perfect, it was extremely easy to install and runs great. It also ties into other products they have, check out the site, you can see the ratings in action on my site www.jeannettejayhawksfootball.blogspot.com

Amanda, I mean no harmful intentions here, and am most certainly not trying to drive people away from your fantastic work here. But this other method was way easier to install, and looks great! Blends in with my site colors.

For anyone having problems, take a look at JS-Kit

23 July 2008 14:23 Radio F.C. said...

worked for me but it appears twice at the bottom of my posts - any ideas why this would be happening?

23 July 2008 16:41 Reavel said...

Hey Amanda I cant see my stars. I tried it but they didnt come up. I might try it again but well.

24 July 2008 10:33 Radio F.C. said...

resolved it by following the steps here (as advised above): http://www.knowliz.com/2008/07/how-to-add-star-rating-to-custom.html

6 August 2008 09:40 Boffill said...
This post has been removed by the author.
6 August 2008 09:46 Boffill said...

I have already figured out the problem. Thanks for your tutorial Amanda. Your blog really helped me a lot! More power!

7 August 2008 10:49 Mr. M said...

Does this work for classic template.. i do not have widgets.

13 August 2008 17:46 WeblogLearner said...

Isn't it fascinating? I have been browsing your blog all day to put some flicks in my blog. Thank you for your genius mind that we can beautify our blogs.

18 August 2008 09:25 Mahen said...

Help me!!!!!!!!

I couldnot find any of the code u've told to search for in my template....

http://cooltechwares.blogspot.com

31 August 2008 18:48 admin@yellowturnip.com said...

Another alternative for bloggers needing rating widgets :

Please check out our rating widget service at http://www.yellowturnip.com/blogger.html

You can customize colors/size of the stars,prevent duplicate rating, identify the city location of the raters and list the top rated blogposts in the sidebar of your blog.
No login/registration required.

10 September 2008 21:27 Darwyn4 said...

if this doesn't work, try this: http://gosublogger.com/2008/07/adding-star-rating-to-custom-blogger-templates/

it works for me

16 September 2008 14:59 MIRELA said...

hi
i found a simple step to add star ratings,means u must acces outbrain.com and all is nice..no html cod,only user and password...im from romania and my blog is www.reduceri-imbracaminte.blogspot.com..u can see my stars in my blog:)) bye and thanks AMANDA FOR YOUR SUPPORT OF BLOGGERS

15 October 2008 23:55 iPhoneRuler said...

Hi,

I had the same problem described by Radio F.C. and I solved it following the knowliz tutorial but I would like to change the font-style.. anyone can help me?

http://iphoneruler.blogspot.com

16 October 2008 04:20 LiZa said...
This post has been removed by the author.
19 October 2008 06:48 JJ said...

Thank you! The star ratings showed up twice initially, but I just had to remove similar code just a few lines down from 'step 4.' Works fine now :)

30 November 2008 09:05 Willy said...

Hi. I can't seem to follow instructions. I got stuck at the "edit blog post widget." Thanks.

12 December 2008 20:43
Anonymous said...

pola oznaczone gwiazdką muszą zostać wypełnione
http://florida-id-templat.solik.osa.pl

11 January 2009 16:26 Joana Morais said...

Hello Amanda, happy new year btw, I have one question regarding the ratings code is it possible to add some div style or something in the CSS to change the background & the text colours?

13 January 2009 13:59 Uriah W. said...

Hey Amanda,
Love the site! It's awesome! Anyways, me and some friends run a book reviews site over at www.teencbr.blogspot.com. I use your awesome elegumus template. When I selected the star ratings, it worked but the background doesn't match the post background. Help?
U

17 January 2009 22:09 Samy said...

Thanks Amanda! ^^

19 January 2009 10:40 Open door to everyone... said...

Customizing the bg and text color of this widget is far easier than you think. Read here: http://www.looblog.info/2009/01/customizing-star-rating-widget-for.html

2 February 2009 05:24 Blogger Tutorial said...

Wola, nice share Amanda. Thanks

18 February 2009 08:12 Rahul said...
This post has been removed by the author.
16 March 2009 18:45 Kashim said...

Thanks!
nice blog! 5*

1 May 2009 13:55 eka said...

thank bro for your info, i'll try it first

http://time24get.blogspot.com

7 June 2009 10:19 Shariq said...

not working for me also

6 September 2009 17:43 Freedomlover said...

Is it posible to make Star ratings work with IE8

11 September 2009 19:41 Agus_syahri said...

thanks....let's try!!!

26 September 2009 00:54 Hang Meas MP3 said...

shown nothing on mine please help.

http://rapidlord.blogspot.com and http://hangmeasrapid.blogspot.com

28 October 2009 02:27 ChiangMai guide And tour said...

thank i will try it. i think it work.

10 November 2009 21:02 DesignsbyPhoebe said...

Thank you very much, it works after I follow your instructions but now it displays twice, how do I remove the extra one? Thanks again

12 November 2009 02:16
Anonymous said...

with draft.blogger.com somehow when clicking to post a comment, not able to do so. HELP!!! please. Thanks.

6 December 2009 03:47 marvin said...

ouch.. the code does not work on my blog..

12 December 2009 19:22 Lahori_Munda said...

I add, but its not working, what should i do now?

22 December 2009 06:26 FunAnku said...

It does not work for me too.

20 January 2010 09:45
Anonymous said...

sorry, it didnt work

9 February 2010 18:39 R. Daneel Olivaw said...

It worked for me. At first it showed two ratings. I fixed it by only putting the first chunk of code.

18 February 2010 18:28 Abderahman said...

Oh, It didn't work with me !

I can't find the tags you wrote above in my tamplete.

7 May 2010 17:41 Kerry said...

When I use draft blogger to add the stars, they don't appear.

When I try to add your code, I can't figure out where to put it in my html. I tried locating the lines of code that you referred to, but they don't seem to exist.

Any suggestions? Thanks!

11 May 2010 05:22 GANESH KUMAR said...

dude its not working for me, i cant see the star ratings in my blog,pls help me........just visit my blog http://tvlganesh.blogspot.com....

16 May 2010 14:35 Misadult said...

Thank you very much, it works after I follow your instructions but now it displays twice

Post a Comment

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me