Recommended approach: JavaScript widget
The easiest way to include ImpactStory metrics on a webpage is via our JavaScript widget, shown below. There are two steps:
- Paste this script at the top of your page:
- Paste this div where you want the badges to show.
To use the widget, get your free API key and embed the widget on your page. Your free API key works to track metrics on 1000 unique products. If you've got more than that, hang in there; we're working to increase this limit as we scale to meet demand.
Example
To the left, you can see the result, embedded live on this page: metrics for a sample article, "Mega-phylogeny approach for comparative biology: an alternative to supertree and supermatrix approaches." Hover over each badge to see a brief description; to dive in deeper, click and you'll reach the item page, which has more details, explanation, and context.
You can embed badges next to multiple items on the same page, which is handy for CVs or tables of contents; for example, here are badges for another article, Multistep correlations via covariance processing of COSY/GCOSY spectra: opportunities and artifacts . You can display badges inline like this by embedding them as a span instead of a div (keeping everything else the same).
Required attributes
The JavaScript widget requires three parameters, which are fed in via data- attributes in the embedded div:
data-iduniquely identifies the items you want metrics form. We accept several types of ID, including PubMed IDand DOI. You can also use a url (expressed with http:// prefix) if the only identifier for a research object is its webpage url (SlideShare slides, GitHub software repository, articles without DOIs). If there's another type of identifier you'd like to see supported, let us know; we'll be adding more.data-id-typeis the type of identifier you've used; it must be one ofdoi,pmid, orurl.data-api-keyis the unique key we've assigned your organization. It's easy and free to get one; just submit a ticket or drop us an email. Of course, since the key will be served along with your page, it's not really secret, but it's helpful for us in debugging and tracking usage.
Optional attributes
You can also customize the display of badges using one of several of optional data- attributes:
| Attribute | Does | Looks like |
|---|---|---|
data-badge-size
|
Set to |
|
data-badge-type
|
Set to |
|
data-on-finish
|
The name of a javascript callback to run, defined in the global (window) namespace.
The function will be fed two arguments: a
countBadges = function(awards, div$) {
div$.append(
"<div>" +awards.length+ " badges!</div>"
)
}
and then include data-on-finish="countBadges" in your ImpactStory div,
the countBadges function runs when the badges are done loading.
|
|
data-verbose-badges
|
Set to |
|
data-show-logo
|
Set to |
|
data-badge-palette
|
Set to |
|
data-show-badges
|
Set to |
Notes
- Scopus and CiteULike metrics are not available in the widget.
- The embed code loads our javascript widget source (this file on GitHub plus bundled libraries), css, images, and makes an analytics logging call.
- If you've got any feedback, ideas, or questions, let us know!
- For a slew of extra features, check out phayes's very nice Javascript client library. We'll acutally be rolling some of these into the main codebase presently.
More versatile approach: REST api.
If the JavaScript widget described above doesn't meet your needs, you can use our API directly. The ImpactStory webapp itself is built directly on top of this API.
Documentation for current version of the REST API (/v1).

