Skip to main content

Function: getHydratedAds()

getHydratedAds<T>(args, fetcher, matcher, options?): Promise<HydratedAdsResponse<T>>

Defined in: facade.ts:70

Fetches and enriches ad offers with corresponding product details.

This function retrieves ads, fetches the products of the sponsored products and of the Story ads in one fetcher call, as hydrateAds, and then returns them with the advertisement data, the same for both. It waits for the products: a fetcher failure rejects, Stories included. To show the ads before their products, call getRawAds and then hydrateAds.

Type Parameters​

T​

T extends object

Parameters​

args​

GetAdsArgs

Targeting arguments to fetch ads.

fetcher​

ProductFetcher<T>

Function to fetch product details from given offers.

matcher​

ProductMatchesOffer<T>

Function to match products with offers.

options?​

GetAdsOptions

Request options, such as a signal to cancel them. The signal cancels the ad server request and the fetcher's product request.

Returns​

Promise<HydratedAdsResponse<T>>

hydratedAds The sponsored search result consisting of products that are sponsored by the ad server.