This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Link Metrics

Overview

The following operations allow you to work with Link Metrics . Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Link Metrics , see Sample configuration.

OperationDescription

getLinkClicks

Returns the number of clicks on a single bitly link.

getLinkCountriesReturns metrics about the countries referring click traffic to a single bitly link.
getLinkReferringDomainReturns metrics about the domains referring click traffic to a single bitly link.
getLinkSharesReturns metrics about a shares of a single link.

Operation details

This section provides further details on the operations related to Link Metrics.

Get a bitly short URL

The getLinkClicks operation returns the number of clicks on a single bitly link .

getLinkClicks
<bitly.getLinkClicks>
        <urlforLinkCkick>{$ctx:urlforLinkCkick}</urlforLinkCkick>
 </bitly.getLinkClicks>
Properties
  • urlforLinkCkick: a Bitly link
Sample request

Following is a sample REST/JSON request that can be handled by the getLinkClicks operation.

Sample Request for getLinkClicks
{
"urlforLinkCkick":"http://bit.ly/1sOskGp"
}
Related Bitly documentation

http://dev.bitly.com/link_metrics.html#v3_link_clicks

Get metrics about the countries referring click traffic to a single bitly link .

The getLinkCountries operation returns metrics about the countries referring click traffic to a single bitly link .

getLinkCountries
<bitly.getLinkCountries>
    <urlforLinkCountry>{$ctx:urlforLinkCountry}</urlforLinkCountry>
</bitly.getLinkCountries>
Properties
  • urlforLinkCountry: a Bitly link

Sample request

Following is a sample REST/JSON request that can be handled by the getLinkCountries operation.

Sample Request for getLinkCountries
{
"urlforLinkCountry":"http://bit.ly/1sOskGp"
}
Related Bitly documentation

http://dev.bitly.com/link_metrics.html#v3_link_countries

The getLinkReferringDomains operation returns metrics about the domains referring click traffic to a single bitly link .

getLinkReferringDomains
<bitly.getLinkReferringDomains>        
     <urlforReferringDomain>{$ctx:urlforReferringDomain}</urlforReferringDomain>
</bitly.getLinkReferringDomains>
Properties
  • urlforReferringDomain: a Bitly link.

Sample request

Following is a sample REST/JSON request that can be handled by the getLinkReferringDomains operation.

Sample Request for getLinkReferringDomains
{
"urlforReferringDomain":"http://bbc.in/1i0aaNh"
}
Related Bitly documentation

http://dev.bitly.com/link_metrics.html#v3_link_referring_domains

Get metrics about a shares of a single link.

The getLinkShares operation returns metrics about a shares of a single link. .

getLinkShares
<bitly.getLinkShares>
     <urlforLinkShares>{$ctx:urlforLinkShares}</urlforLinkShares>            
</bitly.getLinkShares>
Properties
  • urlforLinkShares: a Bitly link.

Sample request

Following is a sample REST/JSON request that can be handled by the getLinkShares operation.

Sample Request for getLinkShares
{
"urlforLinkShares":"http://www.myfootballgames.co.uk/game/353/World-Cup-Penalty.html"
}
Related Bitly documentation

http://dev.bitly.com/links.html#v3_user_link_save 

Sample request

Following is a sample REST/JSON request that can be handled by the getLookup operation.

Sample Request for getLookup
{
"urlforLookup":"http://google.com/"
}
Related Bitly documentation

Sample configuration

Following is a sample proxy service that illustrates how to connect to Bitly with the init operation and use the getLinkClicks operation. The sample request for this proxy can be found in getLinkInfo sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="bitly"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
       <inSequence onError="faultHandlerSeq">
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="bitlyLink" expression="json-eval($.bitlyLink)" />
         <bitly.init>
            <accessToken>{$ctx:accessToken}</accessToken>
         </bitly.init>
         <bitly.getLinkClicks>
        	<urlforLinkCkick>{$ctx:urlforLinkCkick}</urlforLinkCkick>
 		</bitly.getLinkClicks>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>