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.qualifio.com/v1/campaignfeed/channels/bdf80c4e-8498-46cd-865b-c0379dfff0ed/xml?clientId=322
- JSON
https://api.qualifio.com/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.qualifio.com/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
limit
Specifies the maximum number of campaigns to return in the response.
The default value is 100. The value of limit
can be adjusted, but cannot exceed 500.
cursor
By default, each campaign feed response includes up to 100 campaigns, as determined by the limit
parameter.
To retrieve subsequent campaigns, use the cursor
parameter with the ID of the last campaign from the previous response (e.g., cursor=1234567
).
channelOrder
Specifies the sort direction for campaigns. Valid values are ASC
(ascending, default) and DESC
(descending).
Campaigns are ordered by creation date in ascending order (oldest to newest) by default.
To display the most recently created campaigns first, set channelOrder=DESC
.
orderBy
Specifies the field by which campaigns are sorted. Valid values are CREATION_DATE
(default) and START_DATE
.
By default, campaigns are sorted by their creation date. To sort campaigns by their publication start date, use orderBy=START_DATE
.
When this parameter is set, the channelOrder
parameter can be used to specify the sort direction.
Note: The
cursor
parameter is not supported when usingorderBy=START_DATE
. In this case, only the first set of campaigns, as defined by thelimit
parameter (default: 100), will be returned.