Using the third-party EPrints plugin for Altmetric

An EPrints plugin for Altmetric was released in Autumn. The source files and documentation can be found here. Please note that the plugin was not developed by Altmetric, but was created by a third-party. As such, you should use the plugin at your own risk and direct any technical support requests to the developer of the plugin.

Using the Altmetric embeds on EPrints (wrapper method)

Warning! Though we've tested this script the code remains untested in the real world. It's possible that use in a production environment will turn up bugs - let us know if anything does go wrong and we'll try our best to fix things.

To save some implementation time we've developed a wrapper for the standard Altmetric embed script that should make it easier to use on EPrints article pages.

By default the Altmetric embeds require you to specify the DOI of the article you want to see data for, by including a data-doi attribute. Depending on how handy you are with EPrints page templates this can be tricky.

By using the eprints.embed.js script instead you can skip that part of things: it should pick DOIs up automatically (if they're available) from metadata on the EPrints pages.

To use it instead of the normal Altmetric embed script you should include this line somewhere on your article pages:

<script src='http://d1uo4w7k31k5mn.cloudfront.net/eprints.embed.js'></script>

Then simply put a <div> element with the 'altmetric-embed' class wherever you want the Altmetric badge to appear:

<div class='altmetric-embed'></div>

You can still use any of the options listed on the embeds help pageFor example to use donut style badges add a data-badge-type attribute:

<div class='altmetric-embed' data-badge-type='donut'></div>

... or data-badge-popover for a pop-up legend:

<div class='altmetric-embed' data-badge-type='donut'  data-badge-popover='left'></div>

Known limitations

 

This script only works on single article pages - if you want the badges for listings pages you'll need to use the standard script and specify data-doi attributes for each badge on the page.

How it works

The script simply looks for DOIs on the page and then adds a data-doi attribute to the embed automatically before calling in the standard embed script.

In order of preference it:

  1. Looks for something like a DOI in eprints.id_number
  2. Looks for a dx.doi.org link or "DOI:xxx" string in DC.relation
  3. Looks for a dx.doi.org link in eprints.official_url
  4. Looks for a DOI in the eprints.citation string
  5. Matches text on page e.g. "Published item via DOI"