Javascript API

The Sovrn Commerce JavaScript library automatically integrates into your site to monetize clicks on existing links, insert relevant product links when appropriate, and more. Even so, sometimes it makes sense to integrate with Commerce JavaScript explicitly.

Wherever the Commerce JavaScript library is installed, this simple JavaScript API is available for use. URL[, target] )

Redirect to URL in the target window or frame, monetizing the URL before redirection.

This method behaves very much like the native, but with Commerce Convert monetization built in. One behavioral difference to note is that, with, target defaults to _self, not _blank.

Calls to are counted as “clicks” in your Commerce analytics.

When Commerce is disabled by configuration, redirects without monetization.


required; string; format: URL

Any valid target can be used: a window or frame name, or a special target like _blank, _top, etc.

optional; string; default: _self


// send the user to, monetized, in the current window "" );

// do the same, but in a new window "", "_blank" ); link )

Ensure that Commerce will attempt to monetize link when it is clicked.

Commerce Convert automatically monetizes any link on the current page, regardless of when the link is added. In rare circumstances though, it may be necessary to manually notify Commerce about a specific link.

When Commerce is disabled by configuration, does nothing.


required; HTMLAnchorElement or HTMLAreaElement


var iframe = createDynamicIframe(); // defined somewhere else

monetizeIframe( iframe );

function monetizeIframe( iframe ) {
  var i, ii, iframe_links = iframe.contentDocument.links;

  // ensure the VigLink JavaScript knows about each of the iframe's links
  for( i = 0, ii = links.length; i < ii; i++ ) { links[i] );