Campaign Feeds
In order to understand how your admin can create and configure a campaign, feed please Check the page: 'FAQ Campaign Feeds'
Usage
Campaign feeds are useful when you need to automatise gathering a list of campaigns matching given conditions (e.g.: list of active campaigns that are linked to a specific website in Qualifio). Common usages are:
- Generate dynamically a page that includes several campaigns
- List all campaigns to be selected from your CMS
How to use campaign feeds?
Every campaign feed is available through an URL. The format of the response could be either:
- XML
https://api.qualif.io/v1/campaignfeed/channels/bdf80c4e-8498-46cd-865b-c0379dfff0ed/xml?clientId=322
- JSON
https://api.qualif.io/v1/campaignfeed/channels/bdf80c4e-8498-46cd-865b-c0379dfff0ed/json?clientId=322
JSON response
{
"numberRows":10,
"channels":[
{
"channelId":"B7FDCFDA-C477-C4BA-3C54-728AD8594DE6",
"website":{
"id":1036,
"name":"Qualifio - Showcases"
},
"channel":"MINI_SITE",
"id":110990,
"dateCreated":"2016-05-04T16:00:32.670Z",
"dateLastModified":"2022-04-25T12:17:14.147Z",
"campaign":{
"campaignId":110989,
"campaignTitle":"Vote for your Belgians of the year ",
"campaignType":"Sondage ou vote anonyme",
"creator":"Qualifio - Showcases"
},
"schedule":{
"startDate":"2015-02-06T00:00:00.000Z",
"endDate":"2050-12-31T00:00:00.000Z",
"hourlyLimitation":false
},
"integration":{
"javascript":"<div id=\"qualifio_insert_place_110990\" class=\"qualifio_iframe_wrapper\"></div>\n <script type=\"text/javascript\">\n (function(b,o,n,u,s){\n var a,t;a=b.createElement(u);\n a.async=1;a.src=s;t=b.getElementsByTagName(u)[0];\n t.parentNode.insertBefore(a,t);o[n]=o[n]||[]})\n (document,window,'_qual_async','script','//qualifioshowcases.qualifioapp.com/kit/qualp.2.min.js');\n _qual_async.push(['createIframe', 'qualifio_insert_place_110990', 'qualifioshowcases.qualifioapp.com',\n '20', 'B7FDCFDA-C477-C4BA-3C54-728AD8594DE6', '100%', '2656', '', '', '', 'max-width:810px;margin:0 auto;']);\n </script>",
"webview":"https://qualifioshowcases.qualifioapp.com/20/B7FDCFDA-C477-C4BA-3C54-728AD8594DE6/v1.cfm?id=B7FDCFDA-C477-C4BA-3C54-728AD8594DE6",
"html":"<iframe src=\"//qualifioshowcases.qualifioapp.com/20/B7FDCFDA-C477-C4BA-3C54-728AD8594DE6/v1.cfm?id=B7FDCFDA-C477-C4BA-3C54-728AD8594DE6\"\n id=\"qualifio110990\" class=\"qualifio_iframe_tag\" width=\"100%\" height=\"1200\"\n scrolling=\"auto\" frameborder=\"0\" hspace=\"0\" vspace=\"0\" style=\"overflow-x:hidden;max-width: 1200px;\">\n "
}
},
{
"channelId":"B952C4FD-0C73-424B-CD99-16A6AFE9651C",
"website"...
}
]
}
Parse the JSON response
Based on your use case you may iterate on each element of the channels[]
array and read information required by your integration.
For instance you may need the title of the campaign (channel.campaign.campaignTitle
) and the campaign integration tag (channel.integration.javascript
)
<script type="text/javascript">
$.get('https://api.qualif.io/v1/campaignfeed/channels/bdf80c4e-8498-46cd-865b-c0379dfff0ed/json?clientId=322',
function(data, status) {
let campaignsList = $("<div>");
$.each(data.channels,function(key, channel){
$(campaignsList).append($("<h1>").text(channel.campaign.campaignTitle));
$(campaignsList).append(channel.integration.javascript);
});
});
</script>
Supported request parameters
cursor
By design the number of campaigns included in a campaign feed response is limited to 100.
If you need to retrieve the next 100 campaigns, you have to use the cursor
parameter and provide the ID of the last campaign read from the previous request: cursor=1234567
.
channelOrder
By design, campaigns in the feed are ordered in ascending order by their startDate
(oldest to newest).
To sort the campaigns in descending order (newest to oldest), use channelOrder=DESC
. You'll end up with the latest campaigns showing first.