Skip to content
Adam Chambers edited this page Aug 18, 2016 · 7 revisions

Counts

Initialize a count node by specifying the URL to count shares of and the platform(s) to count on.

<span data-open-share-count="facebook" data-open-share-count-url="http://www.digitalsurgeons.com"></span>
<span data-open-share-count="facebook,pinterest,reddit" data-open-share-count-url="http://www.digitalsurgeons.com"></span>

or, with JavaScript:

new OpenShare.count({
  type: 'facebook',
  url: 'http://openshare.social',
  appendTo: document.body
}, node => {
  console.log(`OpenShare has been shared on Facebook ${node.innerHTML} times!`)
  node.style.color = 'blue'
})

Twitter share counts

If you've gone to https://openshare.social/twitter/auth, filled out the information, and received your data-open-share-key then you can do this:

<span data-open-share-count="twitter"
      data-open-share-count-url='http://yourwebsite.com/'
      data-open-share-key="yourkey"></span>

or, with JavaScript

const OpenShare = require('openshare');
OpenShare.count({
    type: 'twitter',
    url: 'http://yourwebsite.com/',
    key: 'yourkey'
});
Clone this wiki locally