# Ad Spaces

An Ad Space is a Node that displays intrinsic advertisements to the player. Ad Spaces load images at runtime in both JPG or PNG formats.

# Creating Ad Spaces

Create an Ad Space by calling frameplay::ad_space::create and configure with the following parameters to best fit your game environment:

  1. Configure the Ad Space Content:
  • Set the image ratio to one of our preset aspect ratios to best fit your environment
  • Set the texture quality multiplier to your required texture quality.
  • Set the refresh type to either dynamic or static (Dynamic ads will refresh a new ad every 60 seconds. Static will only request a single advertisement)
  1. Configure the Ad Space Name to a uniquely identifiable name

  2. Create the Ad Space and set the Ad Space size using the height or width property. (Ad Spaces will remain in their fixed aspect ratio to ensure the advertisement display remains valid)

  3. Set the Ad Space position using the x & y coordinates

  4. Add the child node to your scene graph

#include "frameplay.h"

const content_configuration content_config{
  frameplay::image_ratio::_16x9,
  frameplay::texture_quality_multiplier::original,
  frameplay::refresh_type::dynamic_content,
};

const ad_space_configuration ad_space_config{
  "Level-1 Ad Space",
  content_configuration,
};

const auto ad_space = frameplay::ad_space::create(ad_space_config, frameplay::height(100));
ad_space->setPosition(200, 100);

//Add child to the Scene Graph
this->addChild(ad_space);

You do not need to call ::init(); on the ad space.

# Ad Space Configuration

# Name

A unique description to identify this Ad Space (Eg. position or context in the current Scene). Unique names enables Frameplay to provide accurate Ad Space viewability reporting.

# Content Configuration

The content configuration describes the content that the ad space will display. You can specify the ratio of the Ad Space, adjust the quality of the delivered content, and choose between static or dynamic ad content.

# Ratio

Frameplay offers a variety of horizontal and vertical Ad Space ratios designed to fit in your game environments. There are 11 supported ratios: 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 21:9, 9:21, 40:9, 9:40, 60:9, and 1:1.

# Texture Quality Multiplier

The texture quality multiplier determines the advertisement texture size. Set to either quarter, half or original. This combines with the global texture quality setting to determines the maximum resolution of texture downloaded.

# Refresh Type

Ad Space refresh type can be either dynamic or static. Dynamic ads will refresh a new ad every 60 seconds. This allows for multiple impressions over time. The Static option will only request a single advertisement.

# Size

The frameplay::width or frameplay::height are used to configure the Ad Space size. Ad Spaces will remain in their fixed aspect ratio to ensure the advertisement display remains valid.

# Channel Name (optional)

Ad Spaces with the same Channel Name and Content Configuration will load Synchronized Advertisements. Read more about Synchronzied Ad Spaces here.

# Placeholder Materials

In the instance where an Ad Spaces does not have an advertisement loaded, a Placeholder will be used instead. Default placeholder textures can be found in the resources folder ~"ProjectName"\Resources\Frameplay\Placeholders.

You can customize these Placeholders with your own textures to fit your environment.

Image

# Load a Mock Advertisement

Build and run your Cocos2d-x application. When the Ad Space Node is spawned and visible it will request, download and display a mock advertisement.

Image

# On Ad Loaded Event

on_texture_loaded is a multicast_delegate<void()> on each Ad Space that is fired once an advertisement has been loaded. Subscribe with on_texture_loaded.add(my_listener), where my_listener is an std::function<void()>

Last Updated: 12/16/2022, 8:08:08 PM