Social Metrics API and Metric Webservice

Social Metrics offers an API and Webservice to retrieve like and share count for web pages. You can use the JSON API and a predefined jQuery Plugin.

Use SocialMetrics jQuery Plugin

First include the Social Metrics javascript code:
<script src="//www.socialmetrics.de/latest/jquery.socialmetrics.min.js"></script>
Create a container with metrics inside. Please provide the url to check with the data-url attribute. Add the classes socialmetrics-facebook, socialmetrics-twitter and socialmetrics-gplus to the nodes that needs to show the metrics. It's important to name the nodes exactly like this.
<div class="socialmetrics" data-url="https://www.facebook.com">
  Facebook: <span class="socialmetrics-facebook">0</span><br/>
  Twitter: <span class="socialmetrics-twitter">0</span><br/>
  G+: <span class="socialmetrics-gplus">0</span><br/>
  Overall Shares: <span class="socialmetrics-overall">0</span><br/>
</div>
Then just add the Social Metrics to the defined containers.
<script>
  jQuery(document).ready(function(){
    jQuery('.socialmetrics').socialMetrics();
  });
</script>

Demo

Facebook: 0
Twitter: 0
G+: 0
Overall Shares: 0



© A tricd project