{"__v":5,"_id":"56f462586bd7a20e00d22ae9","category":{"project":"568af724176a6c0d00a29ec4","version":"568af725176a6c0d00a29ec7","_id":"56f45babcb0dce29005a8e85","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-03-24T21:27:07.645Z","from_sync":false,"order":5,"slug":"advanced-use-configuration","title":"Advanced Use & Configuration"},"parentDoc":null,"project":"568af724176a6c0d00a29ec4","user":"568af6d197d8960d0012ab7d","version":{"__v":8,"_id":"568af725176a6c0d00a29ec7","project":"568af724176a6c0d00a29ec4","createdAt":"2016-01-04T22:50:13.289Z","releaseDate":"2016-01-04T22:50:13.289Z","categories":["568af725176a6c0d00a29ec8","56d9d397337fd11300d6a3e3","56d9d4287222d50b0070160b","56f424307ea0091700f63ac5","56f45babcb0dce29005a8e85","5739e5836c5ba134007a197d","57717aee3dd24019004c9122","5771b5d8c755ca0e00617d7d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"createdAt":"2016-03-24T21:55:36.033Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"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\"///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]","excerpt":"","slug":"configuration-with-javascript","type":"basic","title":"Configuration with Javascript"}

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 "///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]