Display banners, assets, and campaigns in search results
Displaying banners
Web admins can create campaigns and assets in the Bloomreach Dashboard. If a campaign applies to your API request, then the response includes a campaign object.
The campaign object contains information to display an asset to your customers. The object includes a bannerType attribute, which indicates how banners are handled. You can set bannerType to image_url, banner_url, or HTML .
Which API responses can include a campaign object?
Search and Merchandising API | Organic API |
Example request with image_url
Here's another example campaign object, this time with the bannerType set to image_url :
Example campaign field: image_url
dateStart: "Sat Sep 24 00:00:00 UTC 2015 name: "White dress campaign", keyword: "women's white dress", bannerType: "image_url", htmlText: "<img src="http://images.example.com/is/image/63097%5Fwomens%5Fwhite%5Flace%5dress%5Fsearch%5Fresults?$jpg12$&scl=1" usemap="#campaignmap269"> <map name="campaignmap269"> <area shape="rect" coords="27,2,399,50" alt="white lace" href="http://www.example.com"> </map>", dateEnd: "Fri Sep 23 00:00:00 UTC 2100", id: "147"
Here's the process that bannerType: "image_url" uses to load the banner for your customers:
- You host the image file on your server.
- Bloomreach returns the link to the image source URL
- Bloomreach includes the image URL in the HTML that displays the banner with the appropriate click regions.
Example request with banner_url
Here's an example campaign object with the bannerType set to banner_url :
Example campaign field: banner_url
dateStart: "Tue Jul 28 00:00:00 UTC 2015", name: "Louboutin - Match All", keyword: "louboutin", bannerType: "banner_url", htmlText: "http://www.example.com/category/search/louboutin1115/r_head_long.html", dateEnd: "Thu Dec 31 00:00:00 UTC 2099", id: "152"
Here's the process that bannerType: "banner_url" uses to load the banner for your customers:
- You host the HTML banner on your server.
- Bloomreach returns the URL to that HTML banner.
- You fetch that HTML and insert it into the results
Example request with HTML
Here's an example campaign object with the bannerType set to HTML:
Example campaign field: HTML
dateStart: "Fri Jul 12 11:19:40 UTC 998013", name: "Sale", keyword: "sale", bannerType: "html", htmlText: "<p><a href=\"”https://www.example.com/v/vspfiles/assets/images/sale.png”\" target=\"”_blank”\">Sale</a> banner</p>", dateEnd: "Fri Jan 12 20:06:43 UTC 1001968", id: "108048"
Here's the process that bannerType: "HTML" uses to load the banner for your customers:
- You host the HTML banner on your server.
- Bloomreach returns the URL to that HTML banner.
- You fetch that HTML and insert it into the results.