hannah
posted this on November 09, 2011 09:40 am
The VigLink affiliation service can be accessed directly through a REST API or managed for you with our JavaScript Library.
The recommended VigLink installation snippet includes our JavaScript library on your page. Once included, the library handles affiliation of external links automatically. Want a little more control? Tweak the options or use its JavaScript API.
Options are set as properties of a global vglnk object. The recommended installation snippet sets api_url and key for you. Most users will not need to modify those values.
Options are only read during initialization. For that reason they must be set prior to including the library, as in the recommended snippet.
<a href="http://example.com" rel="norewrite">VigLink ignores this link</a>VigLink provides a basic HTTP API for URL affiliation. Requests are made via an HTTP GET in the form of http://api.viglink.com/api/<method>[?<parameters>].
The REST API is not available without authorization. If you would like to use the REST API, please send us an email. Include your API key (found on the account page) and a brief description of how you will use the API. We'll respond within 48 hours.
In addition to affiliating an unaffiliated URL, the click method records the click event for use in analytics. For this reason, an application should call click every time a user is about to follow an outbound link, even if the application has cached the response from a prior request.
http://api.viglink.com/api/click?key=<your API key>&out=<URL>&loc=<URL>[&cuid=<str>][&format=go|jsonp|txt][&jsonp=<str>][&reaf=1][&ref=<URL>][&title=<str>][&txt=<str>]
Important: All parameter values must be properly URL-encoded!
If you have legitimate reason not to pass loc please contact us so we can make special arrangements.
The response format is governed by the request's format parameter. In all cases the resulting URL is either an affiliated equivalent of the original URL, or the original URL itself if affiliation is not possible.
foo('<result URL>');