I noticed the “DuckDuckGo” karma widget one day when browsing and decided to play with one.
Its purpose is to gather your “karma” from different websites and display a little box like this one:

I tried it on my site as follows, and it provides the picture above all right.
<div id="footer">
<script type="text/javascript">
ddg_k_title = '';
ddg_k_bold_karma = '1';
ddg_k_link_karma = '0';
ddg_k_link_label = '0';
ddg_k_show_username = '0';
ddg_k_show_service_name = '0';
ddg_k_paren_karma = '0';
ddg_k_vertical_spacing = '5';
ddg_k_column_width = '150';
ddg_k_padding = '5';
ddg_k_font_size = '9pt';
ddg_k_font_color = 'black';
ddg_k_font_family = '';
ddg_k_border = '1px solid #AAA';
</script>
<div id="holder" style="position: relative; height: 76px; width: 50%; margin: 0px auto">
<div id="ddg_k" style="width: 150px; height: 47px; font-size: 9pt; background: white;
padding: 5px; text-align: left; float: left">
</div>
<script type="text/javascript" src="http://karma.duckduckgo.com/k.js?t=1,5&u=Evgeny,evgenyr"></script>
However, there are questions I can not find answers to:
-
I could not locate any documentation. The parameters for k.js I had to literally figure out by trial and error. Can anyone help with that?
-
It still shows the karma for the day when I added the widget to my site – I know the values have changed since. What am I missing?
-
Finally, if anyone can suggest similar widgets I can easily use on a website, that would be duly upvoted!
I didn’t find any documentation for the karma widget either, despite much googling around.
It seems that you have looked into the script, but I’ll nevertheless document some findings here.
Looking in the
k.jsfile that is generated you can see that you specify the sites to show in the widget by using the query parameterstandu:http://karma.duckduckgo.com/k.js?t=1,5&u=Evgeny,evgenyr
This means for the site identified by
1the username isEvgenyand for the site with id5the username isevgenyr. If you look into the script you can see that it is generated on the server side and it has the karma points retrieved already in the script.The identifiers are as follows (straight from the script @ 2012-10-09):
From looking at the code, you can also customize the look’n’feel of the widget by embedding parameters (starting
ddg_k_) as javascript code to your site as you have done. The parameters are almost self-explanatory.The script also needs an element with the id of
ddg_kwhere it places the widget.As for why the values are not updated since adding the widget; I can only come up with a educated guess that there’s some caching going on. At least here the last message mentions some delays. Also there’s some mention about caching issues on the duckduckgo forum. It might also be because the server-side component that retrieves the points is out of date regarding a site.
There’s certainly very scarce information on this topic. 🙂