{"_id":"56f435887ea0091700f63b02","user":"568af6d197d8960d0012ab7d","githubsync":"","__v":12,"project":"568af724176a6c0d00a29ec4","version":{"_id":"568af725176a6c0d00a29ec7","project":"568af724176a6c0d00a29ec4","__v":11,"createdAt":"2016-01-04T22:50:13.289Z","releaseDate":"2016-01-04T22:50:13.289Z","categories":["568af725176a6c0d00a29ec8","56d9d397337fd11300d6a3e3","56d9d4287222d50b0070160b","56f424307ea0091700f63ac5","56f45babcb0dce29005a8e85","5739e5836c5ba134007a197d","57717aee3dd24019004c9122","5771b5d8c755ca0e00617d7d","579639964913990e001a5911","57e57e7df3d7fc0e009c5119","587569b6f4483a0f00d2e6b8"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"56d9d4287222d50b0070160b","__v":1,"pages":["56d9d483aa96cc150020eb35"],"version":"568af725176a6c0d00a29ec7","project":"568af724176a6c0d00a29ec4","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-04T18:30:00.578Z","from_sync":false,"order":2,"slug":"monetized-urls","title":"Monetized URLs"},"parentDoc":null,"updates":["599b4a13eac604000fedb18e","599b4a5d2c071d002fc9b0af","5b72d66ce30d2400031717cb"],"next":{"pages":[],"description":""},"createdAt":"2016-03-24T18:44:24.830Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Creating one-off monetized URLs is easy using [VigLink Anywhere](http://www.viglink.com/products/anywhere). Paste any URL and get a portable VigLink URL which monetizes the original whenever possible.\n\nIt’s sometimes useful to create VigLink Anywhere URLs programmatically. The URL format and behavior are documented below.\n\n##**Request**\n\nURL: http://redirect.viglink.com\nMethod: GET\n\n##**Parameters**\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Parameter\",\n \"h-1\": \"Type\",\n \"h-2\": \"Description\",\n \"0-0\": \"key\",\n \"0-1\": \"string\",\n \"0-2\": \"Your VigLink API key, found on your account page. *Required\",\n \"1-0\": \"u\",\n \"1-1\": \"string\",\n \"1-2\": \"The URL to monetize. URL must be properly encoded. *Required\",\n \"2-0\": \"cuid\",\n \"2-1\": \"string\",\n \"2-2\": \"An ID of your choosing that identifies the clicker, the page the link is on, a campaign or the click itself. See our CUID documentation for details. **32 alphanumeric character limit.\",\n \"3-0\": \"opt\",\n \"3-1\": \"boolean(false)\",\n \"3-2\": \"By default, VigLink will not modify the destination url to help you earn more money. Enable this to send the visitor to the same product at a higher paying retailer.\"\n },\n \"cols\": 3,\n \"rows\": 4\n}\n[/block]\nNote: VigLink Anywhere wraps the [link monetization API](https://viglink-merchant-api.readme.io/docs/building-monetized-links). If any of those parameters are included, they’ll be passed through to the underlying API. One case where that’s especially useful is [advanced revenue tracking](https://viglink-merchant-api.readme.io/docs/overview)—just pass your cuid like normal.\n\n##**Response**\n\nThe server will respond with one of these HTTP status codes:\n\n302\nThe request was successful. The client should be redirected.\n\nIf the input URL (specified by the u parameter) could be monetized, the client is redirected to the monetized version of that URL. If there is no monetized version, the client is redirected to the original URL, unmodified.\n\n400\nRequired parameters are missing, or their values are not valid.\n403\nThe specified URL is unsafe.\n\nTo protect users from malicious web sites, URLs are checked against a list of “bad” sites before redirecting. If the URL is found to be unsafe, a warning page is displayed. For more information visit [stopbadware.org](http://stopbadware.org/).\n\n##**Example**\n\nYou’d like to share a monetized version of this URL: http://amazon.com/dp/0316769487. You must encode it first. So the URL will look like this http%3A%2F%2Famazon.com%2Fdp%2F0316769487\n\nAfter building the monetized link, it should look something like this:\nhttp://redirect.viglink.com?u=http%3A%2F%2Famazon.com%2Fdp%2F0316769487&key=88ac2a40e081e283ac504d1789d398ac\n\nWhen someone follows the VigLink URL, they’ll be redirected to the monetized version of your original URL:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$ curl -D - 'http://redirect.viglink.com?u=http%3A%2F%2Famazon.com%2Fdp%2F0316769487&key=88ac2a40e081e283ac504d1789d398ac'\\n \\nHTTP/1.1 302 Moved Temporarily\\nContent-Length: 0\\nLocation: http://amazon.com/dp/0316769487?tag=vig-20\",\n \"language\": \"curl\"\n }\n ]\n}\n[/block]","excerpt":"VigLink Anywhere let's you create one-off monetized URLs programmatically.","slug":"building-monetized-urls","type":"basic","title":"Building Monetized URLs"}

Advanced Use & Configuration

Building Monetized URLs

Creating one-off monetized URLs is easy using [VigLink Anywhere](http://www.viglink.com/products/anywhere). Paste any URL and get a portable VigLink URL which monetizes the original whenever possible.
It’s sometimes useful to create VigLink Anywhere URLs programmatically. The URL format and behavior are documented below.
##**Request**
URL: http://redirect.viglink.com
Method: GET
##**Parameters**
[block:parameters]
{
"data": {
"h-0": "Parameter",
"h-1": "Type",
"h-2": "Description",
"0-0": "key",
"0-1": "string",
"0-2": "Your VigLink API key, found on your account page. *Required",
"1-0": "u",
"1-1": "string",
"1-2": "The URL to monetize. URL must be properly encoded. *Required",
"2-0": "cuid",
"2-1": "string",
"2-2": "An ID of your choosing that identifies the clicker, the page the link is on, a campaign or the click itself. See our CUID documentation for details. **32 alphanumeric character limit.",
"3-0": "opt",
"3-1": "boolean(false)",
"3-2": "By default, VigLink will not modify the destination url to help you earn more money. Enable this to send the visitor to the same product at a higher paying retailer."
},
"cols": 3,
"rows": 4
}
[/block]
Note: VigLink Anywhere wraps the [link monetization API](https://viglink-merchant-api.readme.io/docs/building-monetized-links). If any of those parameters are included, they’ll be passed through to the underlying API. One case where that’s especially useful is [advanced revenue tracking](https://viglink-merchant-api.readme.io/docs/overview)—just pass your cuid like normal.
##**Response**
The server will respond with one of these HTTP status codes:
302
The request was successful. The client should be redirected.
If the input URL (specified by the u parameter) could be monetized, the client is redirected to the monetized version of that URL. If there is no monetized version, the client is redirected to the original URL, unmodified.
400
Required parameters are missing, or their values are not valid.
403
The specified URL is unsafe.
To protect users from malicious web sites, URLs are checked against a list of “bad” sites before redirecting. If the URL is found to be unsafe, a warning page is displayed. For more information visit [stopbadware.org](http://stopbadware.org/).
##**Example**
You’d like to share a monetized version of this URL: http://amazon.com/dp/0316769487. You must encode it first. So the URL will look like this http%3A%2F%2Famazon.com%2Fdp%2F0316769487
After building the monetized link, it should look something like this:
http://redirect.viglink.com?u=http%3A%2F%2Famazon.com%2Fdp%2F0316769487&key=88ac2a40e081e283ac504d1789d398ac
When someone follows the VigLink URL, they’ll be redirected to the monetized version of your original URL:
[block:code]
{
"codes": [
{
"code": "$ curl -D - 'http://redirect.viglink.com?u=http%3A%2F%2Famazon.com%2Fdp%2F0316769487&key=88ac2a40e081e283ac504d1789d398ac'\n \nHTTP/1.1 302 Moved Temporarily\nContent-Length: 0\nLocation: http://amazon.com/dp/0316769487?tag=vig-20",
"language": "curl"
}
]
}
[/block]