Skip to main content

API

gladsdk

defineAdSlot()

defineAdSlot(adSlotInfo: AdSlotInfo): AdSlot

Create and return an Ad slot with adSlotInfo. If there is a slot generated with adSlotElementId, it returns the previously created slot.

If adSlotInfo.adSlotElementId is not passed, it is set to adUnitId_${AD slot creation number}.

var adSlotInfo = {
adUnitId: 'adUnitId',
};
window.gladsdk.defineAdSlot(adSlotInfo); // adSlotElementId: adUnitId_1
window.gladsdk.defineAdSlot(adSlotInfo); // adSlotElementId: adUnitId_2

hasAdSlot()

hasAdSlot(adSlotElementId: string): boolean

  • Parameter

    adSlotElementId: adSlotInfo.adSlotElementId passed when creating an Ad slot

  • Return

    boolean: Existence of the adSlot created with adSlotElemenetId exists

findAdSlot()

findAdSlot(adSlotElementId: string): AdSlot | null

  • Parameter

    adSlotElementId: adSlotInfo.adSlotElementId passed when creating an Ad slot

  • Return

    Ad slot found by adSlotElementetId. Returns null if it does not exist.

displayAd()

displayAd(divOrAdSlot: string | Element | AdSlot): void

  • Parameter

    divOrAdSlot: div, div id (adSlotElementId), or adSlot of the Ad slot where the ad will be displayed

displayAdWithResponse()

displayAdWithResponse(divOrAdSlot: string | Element | AdSlot, waterfallResponse: WaterfallResponse, dedupReqId?: string): void

Render the Ad slot via the Ad response (waterfallResponse).

  • Parameter

    divOrAdSlot: div, div id (adSlotElementId), or adSlot of the Ad slot where the ad will be displayed

    waterfallResponse: Ad response object to use for Ad rendering

    dedupReqId: ID to identify the duplication control manager when duplication control settings are required

setMediationList()

(Deprecated) setMediationList(waterfallResponse: WaterfallResponse, dedupReqId?: string): void

caution

This API has been deprecated. displayAdWithResponse() is recommended.

Render the Ad slot using the Ad response (waterfallResponse).

  • Parameter

    waterfallResponse: Ad response object to use for Ad rendering

    dedupReqId: ID to identify the duplication control manager when duplication control settings are required

destroyAdSlots()

destroyAdSlots(adSlots?: AdSlot[]): void

Destroy the delivered adSlots. If adSlots is not passed, detroy all slots.

  • Parameter

    adSlots: Array of adSlots to detroy

refreshAdSlots()

refreshAdSlots(adSlots?: AdSlot[]): void

Refresh the passed adSlots. If adSlot is not passed, refresh all slots.

  • Parameter

    adSlots: Array of adSlots to refresh. If adSlots is not passed, refresh all slots.

setGlobalConfig()

setGlobalConfig(gfpConfig: GfpConfig): void

getGlobalConfig()

getGlobalConfig(): GfpConfig

setCustomParam()

setCustomParam(key: string, value: string | string[]): void

getPhase()

getPhase(): string

  • Return

    phase(string): Phase value set in SDK global parameter. If the phase is not set, return the SDK default value of the phase.

getVersion()

getVersion(): string

  • Return

    version(string): SDK version

addEventListener()

addEventListener(event: AdEventType.AD_LOADED, handler: (ad: GfpAd) => void): void

Add an event listener for events from the SDK.

  • Parameter

    event: Event to add listener to

    handler: Callback function to be executed when an event occurs

removeAllEventListener()

removeAllEventListener(): void

Delete all event listeners set in SDK.

setAdDeduplication()

setAdDeduplication(dedupReqId: string, maxDedupReqCount: number): AdDeduplicationManager

Create a duplication control manager.

  • Parameter

    dedupReqId: ID to identify duplication control manager

    maxDedupReqCount: Number of Ad slots to apply duplication control - 1

  • Return

    adDeduplicationManager: Generated duplication control manager. If there is a manager created with dedupReqId, the created manager will be returned.

clearAdDeduplication()

clearAdDeduplication(dedupReqId: string): void

Delete the duplication control manager.

  • Parameter

    dedupReqId: ID to identify duplication control manager

findAdDedupManager()

findAdDedupManager(dedupReqId: string): AdDeduplicationManager | null

  • Parameter

    dedupReqId: ID to identify duplication control manager

  • Return

    adDeduplicationManager: Duplication control manager found by dedupReqId. If not found, it will return null.

setHostMeta()

setHostMeta(key: string, value: number | string | boolean | object): void

For all Ad slots, set the hostMeta value that will be passed to the advertising material on the medium.

  • Parameter

    key & value : hostMeta value in key-value format

setForceSafeFrame()

setForceSafeFrame(forceSafeFrame: boolean): void

Enable/disable SafeFrame for all Ad iFrames to be rendered. If set to true, cross-domain settings and sandbox property values will be added. The Ad iFrame will be rendered in a SafeFrame format. (default: false)

  • Parameter

    forceSafeFrame: Application status of SafeFrame (boolean)

callNativeBounce()

callNativeBounce(): void

Send Bounceback tracking for native Ads. It will be provided to allow the media to call Bounceback tracking if the browser history bounces are not detected, such as SPA pages.

setPrivacySettings()

setPrivacySettings(privacySettingsConfig: { underAgeOfConsent?: boolean; childDirectedTreatment?: boolean; }): void

Settings related to personal information protection. It will not be included in the Ad request if the interface is not called or the detailed parameter value (boolean) is not set. It will only be included in Ad requests if detailed parameter values are delivered.

  • Parameter

    privacySettingsConfig : A configuration object for privacy settings.

    • underAgeOfConsent: Indicates whether advertising is requested for users who are not adults.
    • childDirectedTreatment: Indicates whether the page or app should be treated as a child-directed service under the Children's Online Privacy Protection Act (COPPA).

setContentId()

setContentId(contentId: string): void

  • Parameter

    contentId : Content ID of media using Naver login

adSlot

getter function

Provides a getter function that can check the values set in AdSlot.

  • getAdSlotElementId(): string: adSlotElementId of AdSlot
  • getAdUnitId(): string: adUnitId of AdSlot
  • getAdProviderName(): string | undefined: Ad provider name of the AdSlot. Set to undefined if the Ad provider is not set as the Ad is not rendered yet or has not been rendered.
  • getCreativeType(): string | undefined: Ad type of the AdSlot ("BANNER" | "NATIVE"). Set to `undefined`` if the Ad provider is not set as the Ad is not rendered yet or has not been rendered.

setRenderConfig()

setRenderConfig(renderConfig: RenderConfig): void

If the advertisement needs to be pre-rendered and the exposure event tracking needs to be processed at a specific point in time, set preload in renderConfig. Call initEvent() when starting the exposure event for a pre-rendered advertisement.

  • Parameter

    renderConfig: Rendering settings of adSlot. The property is preloaded.

    adSlot.setRenderConfig({ preload: true });

initEvent()

initEvent(): void

An API that is called when an exposure-related event starts after an ad is rendered as a preload through setRenderConfig().

setCustomParam()

setCustomParam(key: string, value: string | string[]): void

setApsBidTargeting()

setApsBidTargeting(apsTargeting: ApsTargeting): void

setPbjsBidTargeting()

setPbjsBidTargeting(pbjsTargeting: PbjsTargeting[]): void

setClickHandler()

setClickHandler(clickHandler: ClickHandler): void

Handle click events can be customized for Ad slots by setting up a click handler.

For detailed explanations and examples, please refer to the Ad click process customization.

  • Parameter

    clickHandler: A callback function to be executed when a click event occurs for an Ad slot.

    adSlot.setClickHandler(function (curl, furl, ext) {
    console.debug('curl', curl, 'furl', furl, 'ext', ext, 'type', ext.type);
    });

setHostMeta()

setHostMeta(key: string, value: number | string | boolean | object): void

Set the hostMeta value to be passed to the advertising material in the Ad slot.

  • Parameter

    key & value : hostMeta value in key-value format

setForceSafeFrame()

setForceSafeFrame(forceSafeFrame: boolean): void

Enable/disable SafeFrame for all Ad iFrames to be rendered. If set to true, cross-domain settings and sandbox property values will be added. The Ad iFrame will be rendered in a SafeFrame format. (default: false)

  • Parameter

    forceSafeFrame: Application of SafeFrame (boolean)

setNativeClickHandler()

(Deprecated) setNativeClickHandler(clickHandler: ClickHandler): void

caution

This API has been deprecated. setClickHandler() is recommended.

  • Parameter

    clickHandler: A callback function to be executed when a click event occurs for a native Ad slot.

adDeduplicationManager

displayAds()

displayAds(adSlots: AdSlot[]): void

restoreAds()

restoreAds(adSlots?: AdSlot[]): void