"headline": "Test Headline",
"cta": "Download Here"
}

  1. Click Save

  2. Once the Creative has been added to the Flight page, scroll down and click Save

👍

You've successfully created an Ad in the Kevel UI! The next step is to ping the Decision API with information about the ad slot, parse the Response, and insert the information into your CMS.

Requesting an Ad for a Placement

You can use any of our Decision SDKs to make ad requests from your favorite programming language, or you make a POST request directly to the Decision API at https://e-<networkId>.adzerk.net/api/v2 and using the JSON payload below.

Note that networkId will be your own Network ID. You can log into Kevel UI & use the "circle-i" help menu in upper right corner to find your Network ID. All API and SDK actions require it.

{
  "placements": [
    {
      "divName": "div1",
      "networkId": "**Your Network ID**",
      "siteId": "**Your Site ID**",
      "adTypes": [16]
    }
  ]
}
# NOTE: Use your own network and site IDs!
export NETWORK_ID=23
export SITE_ID=667480
export AD_TYPE_ID=16

curl -H "Content-Type:application/json" \
  -X POST \
  -d "{
        \"placements\":[{
            \"divName\":\"div1\",
            \"networkId\":${NETWORK_ID},
            \"siteId\":${SITE_ID},
            \"adTypes\":[${AD_TYPE_ID}]}
      ]}" \
  "https://e-${NETWORK_ID}.adzerk.net/api/v2"
import { Client } from '@adzerk/decision-sdk';

// NOTE: Use your own network and site IDs!
let client = new Client({networkId: 23, siteId: 667480});

let request = {
  placements: [{adTypes: [16]}],
};

client.decisions.get(request).then(response => {
  console.dir(response, {depth: null})
});
import java.util.*;
import com.adzerk.sdk.*;
import com.adzerk.sdk.generated.ApiException;
import com.adzerk.sdk.generated.model.*;
import com.adzerk.sdk.model.DecisionResponse;

public class FetchAds {
  public static void main(String[] args) throws ApiException {
    // NOTE: Use your own network and site IDs!
    Client client = new Client(new ClientOptions(23).siteId(667480));
    Placement placement = new Placement().adTypes(Arrays.asList(16));

    DecisionRequest request = new DecisionRequest()
      .placements(Arrays.asList(placement));
    
    DecisionResponse response = client.decisions().get(request);
    System.out.println(response.toString());
  }  
}
import adzerk_decision_sdk

# NOTE: Use your own network and site IDs!
client = adzerk_decision_sdk.Client(23, site_id=667480)

request = {
  "placements": [{"adTypes": [16]}]
}

response = client.decisions.get(request)
print(response)
require "adzerk_decision_sdk"

# NOTE: Use your own network and site IDs!
client = AdzerkDecisionSdk::Client.new(network_id: 23, site_id: 667480)

request = {
  placements: [{ adTypes: [16] }],
}

pp client.decisions.get(request)
(ns ad-request-sample
  (:import (com.adzerk.sdk Client ClientOptions)
           (com.adzerk.sdk.generated.model DecisionRequest Placement)))

(defn -main []
  ;; NOTE: Use your own network and site IDs!
  (let [client (Client. (doto (ClientOptions. (int 23)) (.siteId (int 667480))))
        request (doto (DecisionRequest.)
                      (.placements [(doto (Placement.) (.adTypes [16]))]))]
    (print (-> client (.decisions) (.get request)))))
import AdzerkSDK

// NOTE: Use your own network and site IDs!
DecisionSDK.defaultNetworkId = 23
DecisionSDK.defaultSiteId = 667480

let client = DecisionSDK()
let p = Placements.custom(divName: "div0", adTypes: [16])

client.request(placements: [p]) {response in
  dump(response)
}

Parsing the Response

  1. Refer here for the Decision API Response details. It'll look something like:
{
  "decisions": {
    "div1": {
      "adId": 111,
      "creativeId": 222,
      "flightId": 333,
      "campaignId": 444,
      "clickUrl": "https://e-1234.adzerk.net/r?...",
      "contents": [
        {
          "type": "html",
          "template": "image",
          "data": {
            "imageUrl": "https://static.adzerk.net/xxx.jpg",
            "title": "Test Ad",
            "width": 125,
            "height": 125,
            "customData": {
                 "headline": "Test Headline",
                 "cta": "Download Here"
            }
          },
          "body": "<a href='...'><img src='https://static.adzerk.net/Advertisers/xxx.jpg' title='Test Ad' width="125" height="125"></a>"
        }
      ],
      "impressionUrl": "https://e-1234.adzerk.net/i.gif?..."
    }
  },
  "user": {
    "key": "ad39231daeb043f2a9610414f08394b5"
  } 
}
🚧

This may look like a lot! But for the test, the only fields that will matter are clickURL, imageURL, impressionURL, and any custom JS in the customdata section (the metadata section).

  1. Insert the relevant, parsed information into your CMS or app. Make sure that
    a. The impression URL is fired at time of impression
    b. The click event hits the Click URL
    c. The image pulls from the Image URL

  2. Display and then click on the ad for tracking purposes

Reporting

  1. Go to Reports in the UI
  2. Run a report and see your impression and click!