How to Implement Sovrn Commerce APIs

If you're already using our publisher platform to monetize your site you can streamline the process using our API.

Documentation for all Sovrn Commerce APIs are located here.

Sovrn Commerce offers a variety of APIs. Each API has its own documentation in our developer center, along with configuration and authorization instructions. Please note that all sites/apps/toolbars/etc that you hope to use will need to be approved  by Sovrn's Network Quality team in order for you to affiliate with our merchant partners. 

Skip to Section: 

How to find your site's API key & Secret Key

Aliasing Sovrn Commerce API Calls

A Note About SSL

How to find your site's API key & Secret key

Both your API key and your secret key can be found on the Sites page of your Sovrn Commerce account. Clicking on the "key" icon will reveal the keys for each of your sites:

Screen Shot 2022-07-07 at 3.41.10 PM

Clicking on the key icon will reveal a page with your site's API key. It will also give you the option to generate a secret key which will allow you to use some of our API tools. See below:

Screen Shot 2022-07-07 at 3.42.14 PM

Note: Your secret key can be used to pull all of your account data, and you will not need a secret key for each of your sites. When using the Secret Key with the Sovrn Commerce APIs, use the word "secret" along with your secret key. That is, "secret 1234" rather than just "1234". You can read more about authorization here.

Aliasing Sovrn Commerce API Calls

You can mask the fact that you use Sovrn Commerce's affiliation services by creating "alias" domains for Sovrn's service-related hostnames, and making a slight modification to your Sovrn JavaScript library initialization parameters.

Any publisher can alias the API calls by creating a single CNAME and redirecting Sovrn API calls to that name.

To create the appearance that a page on your website calls publisher-provided services instead of Sovrn Commerce's service, use the following guidelines:

  • Create a DNS CNAME that points to api.viglink.com. We suggest using click.<publisherdomain>.com
  • Change the api_url parameter in the Sovrn Javascript library initialization code on your pages to specify the alias domain name.

 An example altered initialization block is shown below:

<script type="text/javascript">

  var vglnk = { api_url: '//click.mydomain.com/api',

                key: 'mypublisherkey' };

   (function(d, t) {

    var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;

    s.src = ('https:' == document.location.protocol ? vglnk.api_url :

             '//cdn.viglink.com/api') + '/vglnk.js';

    var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);

  }(document, 'script'));

</script> 

A Note About SSL

These instructions apply primarily to non-SSL traffic. Aliasing SSL traffic is more complex because of the security protocols involved. Sovrn does not currently support aliasing its hostnames for SSL (https) traffic.

If your site supports SSL, the code snippet below will function—but viewers accessing the publisher site via SSL will see warnings in their browser.

<script type="text/javascript">

var vglnk = { api_url: '//click.mydomain.com/api',

                key: 'mypublisherkey' };

   (function(d, t) {

    var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;

    s.src = ('https:' == document.location.protocol ? vglnk.api_url :

             '//clickcdn.mydomain.com/api') + '/vglnk.js';

    var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);

  }(document, 'script'));

</script>