Skip to content

SDK Keyword Context Levels and Application

Our SDK allows you to set keywords at three distinct levels, giving you granular control over the targeting of your banners. Understanding these levels—Global, Context, and Placement—is key to effective ad delivery.

Global Keywords

Application: Applied to every banner across your entire application.

Purpose: Ideal for broad, application-wide targeting parameters that never change (e.g., login status, content category).

swift
//Set global SDK keywords
static func setKeywords(_ keywords: RingierAd.Keywords)
//Get global SDK keywords
static func getKeywords() -> Keywords
//Set value for specific global SDK keyword
static func setKeywordKey(_ key: String, value: String)
//Set array value for specific global SDK keyword
static func setKeywordKey(_ key: String, values: [String])
//Remove global SDK keywords
static func removeKeywords()

Context Keywords (Screen-Specific)

Application: Applied to all banners shown within the current "context," which typically corresponds to a single screen or major view controller.

Purpose: Use this for targeting related to the current screen's content (e.g., article ID, sports team, section name).

swift
//Activate context with context-specific keywords. Discards all previously set context keywords.
static func activateContext(keywords: RingierAd.Keywords)

//Set context-specific keywords for specific placement
static func setContextKeywords(_ keywords: RingierAd.Keywords, forPlacement placement: String)

Placement Keywords

Application: Applied to only a single, specific banner placement within the current context (screen).

Purpose: Use this for highly specific targeting for an individual ad placement on a screen (e.g., a specific banner size or a location like "top-of-page").

swift
//Add keyword's value
func addKeyword(_ keyword: String, value: [String])
//Remove keyword's value
func removeValueOfKeyword(_ keyword: String)
//Remove all keywords values
func removeKeywords()
//Example
let banner = RingierAdBannerView()
banner.addKeyword("admforce", value: ["qa"])