This component is not maintained by the Origami team.

While this component may be used, it is not supported directly by the Origami team. We make no guarantees about the support status, though we will help you if we can.

getMoatIvtResponse

Global Function

Wait for moat script to load and return a response based on their API

Returns

  • Promise

Links

clearPageTargetingForKey

Global Function

Removes page targeting for a specified key from GPT ad calls

Links

setPageCollapseEmpty

Global Function

Sets behaviour of empty slots can be 'after', 'before' or 'never'

  • after collapse slots that return an empty ad
  • before collapses all slots and only displays them on true is synonymous with before false is synonymous with never

Links

enableCompanions

Global Function

When companions are enabled we delay the rendering of ad slots until either a master is returned or all slots are returned without a master

Links

updateCorrelator

Global Function

The correlator is a random number added to ad calls. It is used by the ad server to determine which impressions where served to the same page Updating is used to tell the ad server to treat subsequent ad calls as being on a new page

Links

defaults

Global Property

Default configuration set in the constructor.

Links

new Config

Defines a store for configuration information and returns a getter/setter method for access.

Links

new Krux

The Krux class defines an FT.ads.krux instance

Links

new Slot

The Slot class.

Methods

  • parseAttributeConfig - (instance) parse slot attribute config
  • initLazyLoad - (instance) Load a slot when it appears in the viewport
  • initResponsive - (instance) Listen to responsive breakpoints and collapse slots where the configured size is set to false
  • maximise - (instance) Maximise the slot when size is 100x100
  • setName - (instance) If the slot doesn't have a name give it one
  • setResponsiveCreative - (instance) If the slot doesn't have a name give it one
  • collapse - (instance) add the empty class to the slot
  • setFormatLoaded - (instance) sets a classname of the format
  • uncollapse - (instance) remove the empty class from the slot
  • clear - (instance) call the ad server clear method on the slot if one exists
  • destroy - (instance) call the ad server destroySlot method on the slot if one exists
  • submitImpression - (instance) call the ad server impression URL for an out of page slot if it has been configured correctly for delayed impressions
  • fire - (instance) fire an event on the slot
  • addContainer - (instance) add a div tag into the current slot container
  • centerContainer - (instance) Add a center class to the main container
  • labelContainer - (instance) Add a label class to the main container

Links

new Slots

The Slots instance tracks all ad slots on the page configures global page events used by a slot and provides utlity methods that act on all slots

Methods

  • collapse - (instance) Given a slot name or an array of slot names will collapse the slots using the collapse method on the slot
  • uncollapse - (instance) Given a slot name or an array of slot names will uncollapse the slots using the uncollapse method on the slot
  • refresh - (instance) Given a slot name or an array of slot names of slotnames will refresh the slots using the refresh method on the slot
  • clear - (instance) Given a slot name or an array of slot names will clear the slots using the clear method on the slot
  • destroy - (instance) Given a slot name or an array of slot names will destroy the slots using the destroySlot method on the slot and remove the reference to the slot
  • submitImpression - (instance) Given a slot name will submit a delayed impression for the slot
  • initSlot - (instance) Confirms a container in the page exists and creates a Slot object

Links

module:utils/events

Utility methods for o-ads events. Methods defined here are added to the utils object not the utils.event object.

Properties

  • broadcast - Broadscasts an o-ads event
  • on - Sets an event listener for an oAds event
  • off - Removes an event listener for an oAds event
  • once - Sets a one time event listener for an oAds event

Links

module:utils

Utility methods for the advertising library.

Methods

  • isWindow(obj) - (static) Test if an object is the global window object
  • isPlainObject(obj) - (static) Test if an object inherits from any other objects, used in extend to protect against deep copies running out of memory and constructors losing there prototypes when cloned
  • isNonEmptyString(str) - (static) Test if an object is a string with a length
  • extend(...) - (static) Merge or clone objects
  • hash(...) - (static) Create an object hash from a delimited string Beware all properties on the resulting object will have string values.
  • attach(...) - (static) Takes a script URL as a string value, creates a new script element, sets the src and attaches to the page The async value of the script can be set by the seccond parameter, which is a boolean Note, we should use protocol-relative URL paths to ensure we don't run into http/https issues
  • dehyphenise(string) - (static) Remove hyphens from a string and upper case the following letter
  • parseAttributeName(attribute) - (static) remove prefixes from o-ads data attributes and dehyphenise the name
  • getQueryString - (static) return the current documents search or an empty string if non exists also strips the initial ? from the search string for easier parsing This method enables us to mock the search string in our tests reliably and doesn't really serve any other purpose
  • getQueryParamByName(name, url) - (static) Get a query string parameter by name from a url
  • getTimestamp - (static) returns a timestamp of the current date/time in the format YYYYMMDDHHMMSS
  • iframeToSlotName(a) - (static) Given the window object of an iframe this method returns the o-ads slot name that rendered the iframe, if the iframe was not rendered by o-ads this will return false

Links

module:utils/log

Utility methods for logging.

Methods

  • isOn(type) - (static) Determine if debug logging is on and if the type if supported
  • warn - (static) Log a warning message
  • error - (static) Log an error message
  • info - (static) Log an info message
  • start(group) - (static) Start a collapsed group
  • end - (static) End a collapsed group

Links

module:utils/log(type, args)

Safe logger for the browser

parameter type default description
type string Sets the type of log message log, warn, error or info, if not set to one of these values log will be used
args any the arguments to be passed to console[type]

Methods

  • isOn(type) - (static) Determine if debug logging is on and if the type if supported
  • warn - (static) Log a warning message
  • error - (static) Log an error message
  • info - (static) Log an info message
  • start(group) - (static) Start a collapsed group
  • end - (static) End a collapsed group

Links

module:utils

Utility methods for postMessage api.

Methods

  • isWindow(obj) - (static) Test if an object is the global window object
  • isPlainObject(obj) - (static) Test if an object inherits from any other objects, used in extend to protect against deep copies running out of memory and constructors losing there prototypes when cloned
  • isNonEmptyString(str) - (static) Test if an object is a string with a length
  • extend(...) - (static) Merge or clone objects
  • hash(...) - (static) Create an object hash from a delimited string Beware all properties on the resulting object will have string values.
  • attach(...) - (static) Takes a script URL as a string value, creates a new script element, sets the src and attaches to the page The async value of the script can be set by the seccond parameter, which is a boolean Note, we should use protocol-relative URL paths to ensure we don't run into http/https issues
  • dehyphenise(string) - (static) Remove hyphens from a string and upper case the following letter
  • parseAttributeName(attribute) - (static) remove prefixes from o-ads data attributes and dehyphenise the name
  • getQueryString - (static) return the current documents search or an empty string if non exists also strips the initial ? from the search string for easier parsing This method enables us to mock the search string in our tests reliably and doesn't really serve any other purpose
  • getQueryParamByName(name, url) - (static) Get a query string parameter by name from a url
  • getTimestamp - (static) returns a timestamp of the current date/time in the format YYYYMMDDHHMMSS
  • iframeToSlotName(a) - (static) Given the window object of an iframe this method returns the o-ads slot name that rendered the iframe, if the iframe was not rendered by o-ads this will return false

Links

Ads#init(options)

Instance Method

Initialises the ads library and all sub modules

parameter type default description
options object a JSON object containing configuration for the current page

Links

slotMethods.defineSlot

Static Method

define a GPT slot

Links

slotMethods.destroySlot

Static Method

Tell gpt to destroy the slot and its metadata

Links

slotMethods.setUnitName

Static Method

Set the DFP unit name for the slot.

Links

slotMethods.addServices

Static Method

Add the slot to the pub ads service and add a companion service if configured

Links

slotMethods.setCollapseEmpty

Static Method

Sets the GPT collapse empty mode for a given slot values can be 'after', 'before', 'never' after as in after ads have rendered is the default true is synonymous with before false is synonymous with never

Links

slotMethods.setURL

Static Method

Sets page url to be sent to google prevents later url changes via javascript from breaking the ads

Links

slotMethods.setTargeting

Static Method

Adds key values from a given object to the slot targeting

Links

FT.ads.config

Static Method

The FT.ads.config object holds the confiuration properties for an FT.ads.gpt instance. There are four tiers of configuration; cookie level config, default config (set within the constructor), metatag config and global (env) config. Global config, (set in the page FT.env ojbect) takes priority over meta followed by default config with cookie config having the least priority. The FT.ads.config() function acts as an accessor method for the config; allowing getting and setting of configuration values. Calling config() with no parameters returns the entire configuration object. Calling config passing a valid property key will envoke the 'getter' and return the value for that property key. Calling config passing a valid property key and a value will envoke the setter and set the value of the key to the new value. Calling config passing an object of keys and values will envoke a setter that extends the store with the object provided.

Links

Slot#parseAttributeConfig

Instance Method

parse slot attribute config

Links

Slot#initLazyLoad

Instance Method

Load a slot when it appears in the viewport

Links

Slot#initResponsive

Instance Method

Listen to responsive breakpoints and collapse slots where the configured size is set to false

Links

Slot#maximise

Instance Method

Maximise the slot when size is 100x100

Links

Slot#setName

Instance Method

If the slot doesn't have a name give it one

Links

Slot#setResponsiveCreative

Instance Method

If the slot doesn't have a name give it one

Links

Slot#collapse

Instance Method

add the empty class to the slot

Links

Slot#setFormatLoaded

Instance Method

sets a classname of the format

Links

Slot#uncollapse

Instance Method

remove the empty class from the slot

Links

Slot#clear

Instance Method

call the ad server clear method on the slot if one exists

Links

Slot#destroy

Instance Method

call the ad server destroySlot method on the slot if one exists

Links

Slot#submitImpression

Instance Method

call the ad server impression URL for an out of page slot if it has been configured correctly for delayed impressions

Links

Slot#fire

Instance Method

fire an event on the slot

Links

Slot#addContainer

Instance Method

add a div tag into the current slot container

Links

Slot#centerContainer

Instance Method

Add a center class to the main container

Links

Slot#labelContainer

Instance Method

Add a label class to the main container

Links

Slots#collapse

Instance Method

Given a slot name or an array of slot names will collapse the slots using the collapse method on the slot

Links

Slots#uncollapse

Instance Method

Given a slot name or an array of slot names will uncollapse the slots using the uncollapse method on the slot

Links

Slots#refresh

Instance Method

Given a slot name or an array of slot names of slotnames will refresh the slots using the refresh method on the slot

Links

Slots#clear

Instance Method

Given a slot name or an array of slot names will clear the slots using the clear method on the slot

Links

Slots#destroy

Instance Method

Given a slot name or an array of slot names will destroy the slots using the destroySlot method on the slot and remove the reference to the slot

Links

Slots#submitImpression

Instance Method

Given a slot name will submit a delayed impression for the slot

Links

Slots#initSlot

Instance Method

Confirms a container in the page exists and creates a Slot object

Links

Targeting#getFromConfig

Instance Method

getFromConfig returns an object containing all the key values pairs specified in the dfp_targeting config.

Links

Targeting#socialFlow

Instance Method

If there is a query parameter called socialflow=xxx, we need to add it as a tag

Links

module:utils/events.broadcast

Static Property

Broadscasts an o-ads event

Links

module:utils/events.on

Static Property

Sets an event listener for an oAds event

Links

module:utils/events.off

Static Property

Removes an event listener for an oAds event

Links

module:utils/events.once

Static Property

Sets a one time event listener for an oAds event

Links

module:utils.isWindow(obj)

Static Method

Test if an object is the global window object

parameter type default description
obj object The object to be tested

Returns

  • boolean - true if the object is the window obj, otherwise false

Links

module:utils.isPlainObject(obj)

Static Method

Test if an object inherits from any other objects, used in extend to protect against deep copies running out of memory and constructors losing there prototypes when cloned

parameter type default description
obj object The object to be tested

Returns

  • boolean - true if the object is plain false otherwise

Links

module:utils.isNonEmptyString(str)

Static Method

Test if an object is a string with a length

parameter type default description
str object The object to be tested

Returns

  • boolean - true if the object is a string with a length greater than 0

Links

module:utils.extend(...)

Static Method

Merge or clone objects

parameter type default description
deep/target boolean/object If boolean specifies if this should be a deep copy or not, otherwise is the target object for the copy
target object If deep copy is true will be the target object of the copy
objects object All other params are objects to be merged into the target

Returns

  • object - The target object extended with the other params

Links

module:utils.hash(...)

Static Method

Create an object hash from a delimited string Beware all properties on the resulting object will have string values.

parameter type default description
str string The string to transform
delimiter string | regexp The character that delimits each name/value pair
pairing string The character that separates the name from the value

Returns

  • object

Links

module:utils.attach(...)

Static Method

Takes a script URL as a string value, creates a new script element, sets the src and attaches to the page The async value of the script can be set by the seccond parameter, which is a boolean Note, we should use protocol-relative URL paths to ensure we don't run into http/https issues

parameter type default description
scriptUrl string The url to the script file to be added
async boolean Set the async attribute on the script tag
callback function A function to run when the script loads
errorcb function A function to run if the script fails to load

Returns

  • HTMLElement - the created script tag

Links

module:utils.dehyphenise(string)

Static Method

Remove hyphens from a string and upper case the following letter

parameter type default description
string string the string to parse

Returns

  • string

Links

module:utils.parseAttributeName(attribute)

Static Method

remove prefixes from o-ads data attributes and dehyphenise the name

parameter type default description
attribute

Returns

  • string

Links

module:utils.getQueryString

Static Method

return the current documents search or an empty string if non exists also strips the initial ? from the search string for easier parsing This method enables us to mock the search string in our tests reliably and doesn't really serve any other purpose

Returns

  • string

Links

module:utils.getQueryParamByName(name, url)

Static Method

Get a query string parameter by name from a url

parameter type default description
name
url

Returns

  • string | null

Links

module:utils.getTimestamp

Static Method

returns a timestamp of the current date/time in the format YYYYMMDDHHMMSS

Returns

  • string

Links

module:utils.iframeToSlotName(a)

Static Method

Given the window object of an iframe this method returns the o-ads slot name that rendered the iframe, if the iframe was not rendered by o-ads this will return false

parameter type default description
a window window object

Returns

  • String | Boolean

Links

module:utils/log.isOn(type)

Static Method

Determine if debug logging is on and if the type if supported

parameter type default description
type string

Links

module:utils/log.warn

Static Method

Log a warning message

Links

module:utils/log.error

Static Method

Log an error message

Links

module:utils/log.info

Static Method

Log an info message

Links

module:utils/log.start(group)

Static Method

Start a collapsed group

parameter type default description
group string the name of the group, defaults to o-ads

Links

module:utils/log.end

Static Method

End a collapsed group

Links