Introduction

The Content.ad Widget API is a flexible alternative to the standard JavaScript implementation. Widget results are returned as a JSON object, and settings (number of ads, type of content, etc.) are managed in the widget section of the Content.ad admin.

Setting Up the API Call

  1. Set up a widget in the Content.ad admin. Performance reports can be broken out by widget or domain. If the domain is new, it must be approved by the Content.ad team before showing sponsored content.
  2. Copy the parameters in the installation code labeled "id" and "d". These are your unique widget ID and unique domain ID, respectively.
  3. Place the parameters, along with the encoded page URL, into the API call below. The domain of the URL must match the domain under which the widget was created.

Copy code here:

http://api.content-ad.net/api.svc/GetWidget/[Unique Widget ID]/[Unique Domain ID]/?url=[Page URL (encoded)]&ipAddress=[Visitor's IP Address]&userAgent=[Visitor's User Agent String (encoded)]

Please note: The visitor’s IP address and encoded user agent included above are only needed when the API call is made server-side.

Optional Query String Parameters

Example JSON Result Set

{
 "slot_count":3,
 "styles": "\u003cstyle type=\"text/css\" id=\"ac_xxxx_css\"\u003e #ac_xxxx { clear:both; display:block; text-align:left; margin:20px 0; position:relative; text-align:left; line-height:1em; }...",
 "articles":
 [
  {
  "slot": 1,
  "url": "http://example.content.ad/sample-url-here",
  "title": "A Very Interesting Article You May Like",
  "image": "http://example.content.ad/sample-image.jpg"
  "sponsored": false
  },
  {
  "slot": 2,
  "url": "http://example.content.ad/sample-url-here-2",
  "title": "Another Interesting Article You May Like",
  "image": "http://example.content.ad/sample-image-2.jpg"
  "sponsored": true,
  "sponsored_by": "domain.com"
  },
  {
  "slot": 3,
  "url": "http://example.content.ad/sample-url-here-3",
  "title": "Yet Another Interesting Article You May Like",
  "image": "http://example.content.ad/sample-image-3.jpg"
  "sponsored": true,
  "sponsored_by": "anotherdomain.com"
  }
 ]
}
Did this answer your question?