{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Configuration with Javascript","type":"basic","slug":"configuration-with-javascript","excerpt":"","body":"The [HTML snippet ](https://publishers.viglink.com/install)provided for installation includes only basic configuration, like your API key. There are a handful of other options you can use to configure the VigLink JavaScript library.\n\nMost users will not need to use these options.\n\n##**Options**\n**key**\nYour VigLink API key, found on your [account page](https://publishers.viglink.com/account). required; string\n\n**api_url**\nThe base URL for API calls. If you’re using your own CNAME for api.viglink.com, be sure to set this option to\n\"//<your CNAME>/api\".\noptional; string; default:\n\"//api.viglink.com/api\"\n\n**cuid**\nIf set, this value is included as the CUID when the library makes API calls on this page. See the [revenue tracking](https://viglink-merchant-api.readme.io/docs/overview) and [CUID](https://viglink-merchant-api.readme.io/docs/cuid-revenue-tracking) documentation for details.\noptional; string\n\n**enabled**\nEnable the library. When set to false, library initialization will be aborted immediately and no API calls will occur. When disabled, [JavaScript API](http://www.viglink.com/developers/library/js-api) methods will work in a failsafe mode, so the user experience is not affected.\noptional; boolean; default: true\n\n**reaffiliate**\nBy default, VigLink will not modify links which are already affiliated. To force re-affiliation for a single page, set reaffiliate to true. If you’d like to force re-affiliation globally, you can make that change in your VigLink se[](https://publishers.viglink.com/settings)ttings.\noptional; boolean; default: false\n\n##**Example**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var vglnk = {\\nkey:  \\\"88ac2a40e081e283ac504d1789d398ac\\\",\\ncuid: \\\"abc123\\\"\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","updates":[],"order":2,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56f462586bd7a20e00d22ae9","user":"568af6d197d8960d0012ab7d","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["568af725176a6c0d00a29ec8","56d9d397337fd11300d6a3e3","56d9d4287222d50b0070160b","56f424307ea0091700f63ac5","56f45babcb0dce29005a8e85","5739e5836c5ba134007a197d","57717aee3dd24019004c9122","5771b5d8c755ca0e00617d7d","579639964913990e001a5911","57e57e7df3d7fc0e009c5119","587569b6f4483a0f00d2e6b8","5ca3c2274439e800149daf96"],"_id":"568af725176a6c0d00a29ec7","project":"568af724176a6c0d00a29ec4","releaseDate":"2016-01-04T22:50:13.289Z","__v":12,"createdAt":"2016-01-04T22:50:13.289Z"},"githubsync":"","parentDoc":null,"__v":6,"createdAt":"2016-03-24T21:55:36.033Z","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Advanced Use & Configuration","slug":"advanced-use-configuration","order":7,"from_sync":false,"reference":false,"_id":"56f45babcb0dce29005a8e85","__v":0,"version":"568af725176a6c0d00a29ec7","createdAt":"2016-03-24T21:27:07.645Z","project":"568af724176a6c0d00a29ec4"},"project":"568af724176a6c0d00a29ec4"}

Configuration with Javascript


The [HTML snippet ](https://publishers.viglink.com/install)provided for installation includes only basic configuration, like your API key. There are a handful of other options you can use to configure the VigLink JavaScript library. Most users will not need to use these options. ##**Options** **key** Your VigLink API key, found on your [account page](https://publishers.viglink.com/account). required; string **api_url** The base URL for API calls. If you’re using your own CNAME for api.viglink.com, be sure to set this option to "//<your CNAME>/api". optional; string; default: "//api.viglink.com/api" **cuid** If set, this value is included as the CUID when the library makes API calls on this page. See the [revenue tracking](https://viglink-merchant-api.readme.io/docs/overview) and [CUID](https://viglink-merchant-api.readme.io/docs/cuid-revenue-tracking) documentation for details. optional; string **enabled** Enable the library. When set to false, library initialization will be aborted immediately and no API calls will occur. When disabled, [JavaScript API](http://www.viglink.com/developers/library/js-api) methods will work in a failsafe mode, so the user experience is not affected. optional; boolean; default: true **reaffiliate** By default, VigLink will not modify links which are already affiliated. To force re-affiliation for a single page, set reaffiliate to true. If you’d like to force re-affiliation globally, you can make that change in your VigLink se[](https://publishers.viglink.com/settings)ttings. optional; boolean; default: false ##**Example** [block:code] { "codes": [ { "code": "var vglnk = {\nkey: \"88ac2a40e081e283ac504d1789d398ac\",\ncuid: \"abc123\"\n}", "language": "javascript" } ] } [/block]