Sports Reference Widgets

How to build your own widgets

Please note that there are some dangers to using widgets (this is true of all widgets, facebook, twitter, etc). Should our servers go down the content would no longer be served. If our servers get badly taxed, the widgets could slow some of the rendering of your pages. We will always do our best to make sure our site is not a problem, but we must be upfront about the risks.

Widgets require the placement of a script tag in the page to get the widget text.

The overall widget content is wrapped in a div with class sr_widget. The content is wrapped in a div with class sr_widget_content and the footer is wrapped in a div with class sr_widget_footer.

You can use these classes to style the content separately from the page, or we provide css for use if you add the url parameter "&css=1" to the script request. The example below uses this css and then below that how it would be called without.

Suggest Widgets You'd Like to See

Baseball Reference Widgets

Division Standings
This will provide the current season standings updated at the same time that Baseball-Reference.com is updated. If division is left blank it will print out the standings for the entire league.
No
Yes
Code for Widget (copy and insert into your webpage to use) :

Basketball Reference Widgets

Division Standings
This will provide the current season standings updated at the same time that Basketball-Reference.com is updated. If division is left blank it will print out the standings for the entire conference.
No
Yes
Code for Widget (copy and insert into your webpage to use) :

Hockey Reference Widgets

Division Standings
This will provide the current season standings updated at the same time that Hockey-Reference.com is updated. If division is left blank it will print out the standings for the entire conference.
No
Yes
Code for Widget (copy and insert into your webpage to use) :

Pro Football Reference Widgets

Seasonal Division Standings
This will provide the current season standings updated at the same time that Pro-Football-Reference.com is updated. If division is left blank it will print out the standings for the entire conference.
No
Yes
Code for Widget (copy and insert into your webpage to use) :

Build Your Own Widgets

You can also create a widget out of any table of stats on an SR site. The easiest way to get this code is to click on the "Embed" tooltip found just above the stat table you wish to embed.

You can also construct the code yourself, but this is a more advanced technique. The example below is the code for Ray Allen's per-game stats. To convert this to another player, just replace "a/allenra02" with the appropriate id for the player in question. For example, for Larry Bird you would use "b/birdla01". These id's can be retrieved from the player's Basketball-Reference.com page.

To exclude a particular set of columns add a parameter "&del_col=1,2,3,12". This example would delete columns 1,2,3, and 12.

To exclude a particular set of rows add a parameter "&del_row=2,3,12". This example would delete rows 2,3, and 12. Note that row 1 is the header.

To set a max set of rows to display, add a parameter "&max_rows=12". This example would cap the number of rows at 12 (including headers).

Ray Allen with CSS

Ray Allen

We can't show this as the css is loaded above.