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. These are not the same as the Widget ID and Domain ID in the user interface. They are the long strings in the widget installation code.
  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 and must include “http://” or”https://”.
http://api.content-ad.net/api.svc/GetWidget/[Unique Widget ID]/[Unique Domain ID]/?pushid=[Your Unique User ID]&served=false&url=[Domain URL (URL encoded)]&ipAddress=[Visitor's IP Address]&userAgent=[Visitor's User Agent String (URL 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.

Query String Parameters

Parameter Name Expects Operation Required? Default styles Boolean value If true, returns the CSS styles attached to the widget as a string in the JSON object. Optional false callback Function name Wraps result set in function with provided name for JSONP compatibility. Optional none pushid or euid String Subscriber ID for a user on a specific browser and device. Required for Push and Email Subscriptions blank served Boolean value If true, records an impression for the widget. Optional true 

Example JSON Result Set

{
 "impression_key":"{string}",
 "impression_served_url":"https://api.content-ad.net/widget/impression/served?ik=2019091214_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&served=true&wid=XXXXXX&haid=XXXXXX"
 "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
  "sponsored_by": "domain.com"
  "cpc":x.xxxx
  "score":x.xxxx
  },
  {
  "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"
  "cpc":x.xxxx
  "score":x.xxxx
  },
  {
  "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"
  "cpc":x.xxxx
  "score":x.xxxx
  }
 ]
}

The performance score is a general indication of performance across our network. It will not accurately predict relative performance across all networks and should only be used as a guide.

Posting the Impression

If “served=false” for the first call and the widget is served, you MUST make a server side HTTP post request to update the impression to “served=true” by posting the “impression_served_url” received in your results.

See Example JSON Result Set above to locate the “impression_served_url” (2nd row of results)
(Be sure to use the result generated from your API Call – not the example – as it contains XXXXXX for wid & haid and may change over time for specific high performance partners)

http://api.content-ad.net/widget/impression/served?ik=2019091214_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&served=true&wid=XXXXXX&haid=XXXXXX

api version: 1.0.0

Did this answer your question?