Affiliates

Affiliate Partner JavaScript Widget

Our JavaScript widget provides you with a quick and simple way to add a strip of iStock photos or vectors to your site. The widget handles calls to the Getty Images/iStock API and automatically adds your affiliate information to all links back to the iStock website. All of the logic runs in the client’s browser, so there is no added load on your server infrastructure.

To use the widget, add a <script> tag to the page and then add the <istock-affiliate> tag in the HTML where the image list is desired.

For example:

<html>
...
<script src="https://developers.gettyimages.com/libs/affiliate/1.0/istock.js"></script>
...
<hr />
<istock-affiliate api-key="API_KEY" affiliate-id="AFFILIATE_ID" search-phrase="trees" item-count="6"
      orientation="horizontal" image-style="photography" image-size="medium" />
<hr />
...
</html>

The above would produce this output:

affiliate-widget

Attributes

  • api-key: The API Key provided after signing up to be an affiliate. Required
  • affiliate-id: The affiliate id provided after signing up to be an affiliate. Required
  • search-phrase: Specifies the search terms to find the content to be displayed. Optional
  • item-count: Specifies the number of items to display. Valid range is 1 - 20 inclusive. Default value is 10. Optional
  • orientation: Specifies the layout of the images. Valid values are horizontal and vertical. Default is horizontal. Optional
  • image-style: Specifies the graphical style of the images desired. Valid values are photography and vector. If left blank, results will be mixed. Optional
  • title: Specifies text to override the default title displayed by the widget. Optional
  • image-size: Specifies the size of the images to display. Valid values are small, medium and large. Default is medium. Optional

Google Core Web Vitals

To comply with Google Core Web Vitals, we strongly suggest that you mark the width and height of the widget as a placeholder before it is loaded onto the page. You can view these helpful resources for information around Cumulative Layout Shift: 

Multiple Affiliate Widgets on the Same Page

The affiliate widget supports multiple instances on the same page, with a few caveats:

  • To avoid duplicate images being displayed across multiple instances, use the same value for item-count in each instance.
  • Because the result-set is limited to 20 images, the number of widgets multiplied by the item-count value should be less than or equal to 20.

For example, if there are 2 instances of the widget on a page and the item-count for each is set to 10, there will be no duplicate images displayed and both instances will display the desired number of images. However, if there are 3 instances of the widget on the page and item-count is set to 8, the first and second instances of the widget would display 8 images each, but the third instance would only display 4.

Changelog

1.0.8

  • Image size can now be specified using the image-size attribute.

1.0.7

  • Better support for multiple instances of the affiliate widget on the same page.

1.0.6

  • Widget title is now customizable

1.0.5

  • Remove support for IE and Edge as it broke the widget on many affiliate sites.

1.0.4

  • Add support for Internet Explorer 11
  • Add support for Microsoft Edge
  • Add MIT License

1.0.3

  • Update to new Impact Radius tracking link

1.0.2

  • Add widget version to search querystring

1.0.1

  • Add indicator that search call was initiated by widget

1.0.0

  • Initial release
  • Support for Chrome, Firefox and Safari

Affiliate Partner Search API Endpoints

If the Affiliate Widget does not meet your needs, we have two search API endpoints designed specifically for Affiliate Partners:

  • GET /v3/affiliates/search/images
  • GET /v3/affiliates/search/videos

These endpoints are optimized for speed and ease of use, providing you with just the right amount of metadata needed to add image and video search results to your site. Unlike the JavaScript widget, you’ll need to add your Affiliate ID to the destination URL per the instructions from Impact Radius, our Affiliate management partner. The response from this API will provide the metadata and URLs for 20 images or videos.

You can read the full documentation in the AffiliateSearch section of our Open API Documentation (Swagger).