Skip to end of metadata
Go to start of metadata

Creative Template Service

The AppNexus platform categorizes creatives by format, media type, and media subtype. Format defines the resource type of creatives (flash, image, etc.); media type defines the general display style of creatives (banner, expandable, video, etc.); and media subtype defines the specific display style of creatives (standard banner, MediaMind expandable, Standard VAST, etc.).

Standard Templates

For each format, media type, and media subtype combination, AppNexus provides a standard creative template that ensures proper rendering on web pages when creatives are served. You cannot edit these templates, but the Creative Template Service allows you to view them and examine their rendering code.

Custom Templates

If you want to customize the way certain types of creatives render, you can build your own templates. With custom templates, you have complete control of the JavaScript, HTML, or XML rendering code, and you can define macros to prompt your traffickers to enter information and make decisions about the behavior of creatives when they are uploaded.

You can have up to 100 custom templates. Please note, however, that AppNexus does not provide support for creatives that do not render correctly as a result of errors in custom template code.

On This Page

REST API

View all templates (standard and custom):

View standard templates only:

View a specific template:

Add a new custom template:

Modify a custom template:

When you modify a custom template, your changes immediately affect any creatives that are already using the template. If your changes cause these creatives to stop rendering properly, their audit status will be changed to "rejected," and they will stop serving on most third-party inventory.

Delete a custom template:

You cannot delete a custom template that is used by one or more creatives, but you can archive the template to prevent future creatives from using it. See the Archiving a custom template example below for more details.

Creating a Custom Template (iPhone only)

This functionality is for an ad to download a specific app from iTunes. A “direct-link” will not work in iPhone because of security. Therefore, it cannot access the AST Library directly. In lieu of this, we raise an event.

The user should have some prior familiarity with creating custom templates and macros.

To accomplish this:

Create a placement that has a default creative that uses a template. (The templates are stored under Network > Tools > Creative Templates). This lists the templates the member has access to. There’s a set of AppNexus creative templates that are not standard templates. This situation would require a custom template.

The template needs to be associated with the default creative. When that creative is selected, it finds this template. It sends out an additional JavaScript function, along with the creative. It calls that function and then sends that event to the AST library. This will open the iTunes app store from the main page frame, where the AST library is running.

Summarizing:

  1. The template takes in a urI.
  2. It sends an event out to the AST library.
  3. AST core has a listener for this custom event, and it launches iTunes.
  4. We pass this event name and what app store url that we want to open. The url takes you to the specific resource in the iTunes app store.

Example Template

function iTunesClick(url)
{window.parent.document.dispatchEvent(new CustomEvent('apntag_iTunesLaunch', {
detail: { url: url }})); }
document.write('<a
href="#"
onclick="iTunesClick(\\\'${CLICK_URL}\\\');"><img
width="${CREATIVE_WIDTH}" height="${CREATIVE_HEIGHT}"
style="border-style: none" src="${MEDIA_URL}"/></a>');

JSON Fields

Field

Type (Length)

Description

Default

Required On

id

int

The ID of the creative template.

 

PUT/DELETE, in query string

name

string (30)

The name of the creative template.

 

POST

description

string

The description of the creative template.

 

 

member_id

int

Read-only. The ID of the member that owns the template. For standard AppNexus templates, this is null.

 

 

ad_typestring

This field only applies when you are associating creatives to augmented line items.

The type of creative used.  Possible values: 

  • "banner"
  • "video" (includes audio types)
  • "native"

This value determines how auction items are tracked for the line item's buying strategy, paying strategy, optimization options, creative association, and targeting options.

All creatives associated to a line item must have the same ad type, which should match the ad_type selected in the Line Item Service - ALI

  

media_subtype

object

The display style of creatives that can use this template. Each media subtype belongs to a superordinate media type, for example, the "Standard Banner" media subtype belongs to the "Banner" media type. See Media Subtype below for more details.

 

POST

format

object

The format of creatives that can use this template, for example, "image" or "flash". See Format below for more details.

 

POST

is_default

boolean

If true, the template is automatically assigned to creatives that match the template's media type, media subtype, and format. When the creatives are uploaded, this default assignment can be overridden, if necessary. Note that there can be only one default creative template per media type, media subtype, and format combination.

false

 

is_archived

boolean

If true, the template is archived. Archiving a template prevents future creatives from using the template but does not affect creatives already using the template.

false

 

content_js

string

The template's rendering code in JavaScript. The code can include both AppNexus standard macros and your own custom macros. AppNexus macros must begin with the $ symbol, and custom macros must begin with the # symbol. Each custom macro must be defined in the macros array.

 

POST, if content_html and content_xml are not provided

content_html

string

The template's rendering code in HTML. The code can include both AppNexus standard macros and your own custom macros. AppNexus macros must begin with the $ symbol, and custom macros must begin with the # symbol. Each custom macro must be defined in the macros array.

 

POST, if content_js and content_xml are not provided

content_xml

string

Deprecated (as of October 17, 2016).

 

 

callback_content_html

string

When media_subtype is "Popup" or "Popunder", content_js defines the rendering code for the pop window, and this field defines the rendering code for the content in the pop window.

 

 

macros

array of objects

The custom macros used in the content_js, content_html, or content_xml fields. You can include up to 20 custom macros in a template. See Custom Macros below for more details. 

 

 

last_modified

timestamp

Read-only. The date and time when the creative template was last modified.

 

 

Media Subtype

You can use the Media Subtype Service and Media Type Service to view all supported media subtypes and the media types to which they belong. 

Field

Type

Description

Default

Required On

id

int

The ID of media subtype.

 

POST

name

string

Read-only. The name of the media subtype.

 

 

mediatype_id

int

Read-only. The ID of the media type to which the subtype belongs.

 

 

media_type_name

string

Read-only. The name of the media type to which the subtype belongs.

 

 

Format

You can use the Creative Format Service to view all supported creative formats.

Field

Type

Description

Default

Required On

Filter By?

Sort By?

id

int

The ID of creative format.

 

POST

Yes

Yes

name

string

Read-only. The name of the creative format.

 

 

Yes

Yes

Custom Macros

You must define each custom macro used in the content_js, content_html, or content_xml field.

Field

Type (Length)

Description

Default

Required On

code

string (30)

The macro name exactly as it is used in the content_js, content_html, or content_xml field. For example, if #{BORDER_SIZE} is the macro in the content_js field, you would pass "BORDER_SIZE" here. 

 

POST

name

string (50)

The user-friendly name for this macro that traffickers will see when they add creatives that use this template via the UI. 

 

POST

type

enum

The type of value that traffickers will provide for this macro when they add creatives that use this template via the Creative Service or UI. Possible values: "true/false", "string", "url", "integer", "decimal", "string_list", "select_from_list" and "file". For example, on the UI, if you set this to "true/false", traffickers will see the macro name followed by a check box.

 

POST

is_required

boolean

If true, traffickers will be required to provide a value for the macro when adding creatives that use this template.

 

POST

default_value

string

If is_required is false, this is the default value that will be used when traffickers do not provide a value for the macro when adding creatives that use this template.

 

POST, if is_required is false

other_data

string

The accepted values for the macro, if type is "string_list" or "select_from_list".

 

 

Examples

View all creative templates
View a specific creative template
Add a custom template
Modify a custom template
Archive a custom template
Re-activate an archived custom template
Delete a custom template