Revive AdServer (Formerly OpenX Source) Direct Selection
Direct selection is a way to manage delivery of your inventory without using publishers and zones. To use direct selection, you create a selection string and place it directly in the ad tag. The selection string instructs Revive AdServer (Formerly OpenX Source) which banners to consider for delivery.
Direct selection is more flexible and more powerful than using zones to select banners for delivery. However, there is a disadvantage: because the selection is made from within the ad tag, you must change the tag any time you want to change the selection. Direct selection is also more difficult to implement on your website, and is intended for advanced users only.
Statements
A banner has a number of properties, such as ID, width, height and type. A statement provides a property value (or values) that a banner must match to be considered for delivery. For example, you can use direct selection to show a number of HTML banners with a specific width and height, or you can use the ID property to deliver an ad with a specific ID to a web page.
Banner ID statement
To always show a specific banner on a web page, use a banner ID statement. The banner ID statement consists of:
- Property: bannerid
- Separator: a colon
- Value: ID of the banner you want to deliver
- Example: bannerid:3
Campaign ID statement
If you use a campaign ID as a statement, Revive AdServer (Formerly OpenX Source) will consider all banners owned by the specified campaign. The campaign ID statement consists of:
- Property: campaignid
- Separator: a colon
- Value: ID of the campaign you want to select from
- Example: campaignid:12
Width statement
All banners, except text ads, have a fixed width. You can use the width statement to specify a fixed width or to specify a range of widths. A fixed width statement consists of:
- Property: width
- Separator: a colon
- Value: the specific width to use
- Example: width:120
A statement to specify a range of widths consists of:
- Property: width
- Separator: a colon
- Value: the minimum width-maximum width
- Example: width:120-160
If you do not want to specifiy a minimum width, use width:-160 and any size smaller than 160 pixels will be considered. If you do not want to specify a maximum width, use width:120- and any size larger than 120 pixels will be considered. You must specify either the minimum or the maximum width to use the width statement.
Height statement
All banners, except for text ads, have a fixed height. You can use the height statement to specify a fixed height or to specify a range of heights. A fixed height statement consists of:
- Property: height
- Separator: a colon
- Value: the specific height to use
- Example: height:160
A statement to specify a range of heights consists of:
- Property: height
- Separator: a colon
- Value: the minimum height-maximum height
- Example: height:120-300
If you do not want to specifiy a minimum height, use height:-300 and any size smaller than 300 pixels will be considered. If you do not want to specify a maximum height, use height:120- and any size larger than 120 pixels will be considered. You must specify either the minimum or the maximum height to use the height statement.
Dimensions statement
To show banners with a specific width and height, you can use the dimensions statement instead of the width and height statements. The dimensions statement does not have a property identifier and consists of the width of the banner, an “x” as the separator and the height, for example: 468×60. You cannot use ranges of width or height in the dimensions statement.
Textads statement
The text ad statement consists of a simple string: textad.
Keywords statement
The keywords statement is the most powerful of the direct selection statements. You can assign one or more keywords to a banner and you can use the same keywords as a keyword statement. For example, if you assign the keyword “sports” to a banner, it will be considered for delivery if sports is used in a keyword statement. If the banner contains more than one keyword, for example “sports”, “news” and “science”, you can use any one of these keywords to select the banner. Using “sports” will consider the banner, but using “news” will also work.
Selection strings
A selection string is a combination of statements that determines which banners to consider for delivery. The simplest selection string consists of a single statement, for example width:468 or bannerid:33.
For more complex requirements, there is a choice of two methods to use: Use a selection path to help determine the banners to consider for delivery. Use multiple expressions and logical operators to refine the selection.
Selection Paths
Selection paths are used in combination with keyword statements. You can use them with other statements but this is rarely done.
A path consists of a number of keyword statements separated by a forward slash (/), for example sports/formula1/teams/ferrari. Revive AdServer (Formerly OpenX Source) will try to deliver a banner that has all of these keywords. If there is no banner with all keywords, the last word is dropped and Revive AdServer (Formerly OpenX Source) tries to display a banner with the keywords sports, Formula 1 and teams. If there are again no suitable banners available, the ‘teams’ keyword is dropped, and so on.
Selection paths work particularly well with websites that use a tree structure, such as the google directory (http://directory.google.com). There are many general categories on the top page, such as Arts, Computers, Science and Sports. If you click on one of these categories you go to a page with a subset of categories. As you click further, the information becomes more detailed and specialised.
Selection paths are suitable for managing banners in this type of site. For example, to show a banner in category Computers > Programming > Languages > PHP, you can assign the category names as keywords to the banner and use the following path as the selection string: computers/programming/languages/php. This approach requires that you create a separate selection string for each page on your website.
If you want to use selection paths for different sizes of banners on a single page, Revive AdServer (Formerly OpenX Source) cannot determine the size of banner you want to show and banners of different sizes will be considered for delivery. To resolve this, use another statement as a condition for the selection path. After the selection path, add @ and the statement you want to use as a condition for the whole path, for example: sports/f1/teams/ferrari@468×60 or sports/f1/drivers/verstappen@width:160. The first example will show 468×60 pixel banners; the second example will show banners with a width of 160 pixels.
The size of the banner isn’t the only condition you can use for the whole path. It is possible to use any statement you want, even keywords. If you have two or more different locations on the page where you want to show a banner, for example, top and bottom, and you want to be able to determine in which position you want to place the banner you could use an extra keyword. For example: sports/f1/teams@top would try to show a banner with the following keywords: sports, f1, teams and top. If there are no banners available with these keywords, it will drop the ‘teams’ keyword and try to show a banner with only sports, f1 and top. Because ‘top’ is a condition for the whole path, it won’t be dropped.
Advanced selection strings
The most advanced type of selection strings enable you to use logical operators and multiple expressions.
Logical operators
With logical operators, you can combine two or more statements. Revive AdServer (Formerly OpenX Source) supports the following operators: AND, OR and NOT. For example, to show a 468 x 60 pixel banner at the top of a page, the dimensions of the banner form the first statement, the keyword ‘top’ is the second statement, and the statements are combined by the AND operator. If you change the logical operator to OR, only one of the conditions is required for a banner to be considered for delivery.
The logical operators in Revive AdServer (Formerly OpenX Source) appear different to those used in MySQL and PHP, but they function in the same manner. Separate statements with a comma (,) and do not put a space between the operator and the statement. Add a switch before a statement to set an operator:
No switch = OR + (plus) or _ (underscore) = AND - (minus) = NOT
OR example:
The news,sports selection string considers all banners that include the keyword news OR the keyword sports.
AND example:
The news,+sports selection string considers only banners that include both news and sports keywords.
Note: The + switch does not work for banners stored on a remote server. In this case, use the _ switch, for example news,_sports.
NOT example:
The -software,news selection string considers all banners that include the keyword news, but rejects them if they include the keyword software. You can use the – switch before the first statement in the selection string, as shown in this example.
Important: If you combine more than two statements by using different types of logical operators, OR takes precedence over AND and NOT. AND and NOT have equal precedence to each other. It is not possible to use parentheses to force precedence.
Precedence examples:
statement1,+statement2,statement3 is the same as (statement1 AND statement2) OR statement3
statement1,+statement2,statement1,+statement3 is the same as (statement1 AND statement2) OR (statement1 AND statement3) which is the same as statement1 AND (statement2 OR statement3)
statement: news,+science,sports
Without precedence rules this statement can mean two different things:
One option is to consider a banner with both the news and science keyword, or when the sports keyword is assigned, (news AND science) OR sports.
A second option is to consider a banner with the news keyword in combination with the science keyword, or the news keyword in combination with the sports keyword, (news AND science) OR (news AND sports). Precedence rules regard OR as more important than AND, so the first option, prevails.
To set the second option requires a slightly longer selection string:
news,+science,news,+sports
According to the precedence rules this expression can be broken in the following parts: (news AND science) OR (news AND sports).
The statements and logical operators combined are called an expression. Each banner is compared to the expression and only banners that match the whole expression are considered for delivery. This does not mean that all of the statements must be true. For example, the expression bottom,top will evaluate to true if only one of the statements is true. Banners with just the keyword bottom, just the keyword top and with both keywords are all considered for delivery. You can use more than two statements in one expression, but each statement must be separated by a logical operator. If you have 8 statements in an expression, you must have exactly 7 logical operators.
Multiple expressions
An expression is a combination of one or more statements connected by logical operators. A selection string can consist of one or more expressions. Each expression will be executed when the previous expression has failed. Multiple expression must be separated with the character | (pipe) and cannot be separated by spaces.
If the first expression does not match any banner, the second expression is used. If the second expression does not match any banner, the third expression is used. You can specify as many expressions as you like, but each additional expression can require additional system resources such as processing time.
The benefit of using multiple expressions is that you can create a set of ‘backup’ expressions which will be evaluated if the main expression doesn’t match any banners.
Multiple expressions example:
The soccer|sports|main selection string first attempts to display banners with the keyword soccer. If that fails, the keyword sports is evaluated, and finally the keyword main is used.
The soccer,+news|sports,+news|main,+news selection string first attempts to display banners with the keywords soccer and news. If that fails, the keywords sports and news are evaluated and, finally, if this also fails, the keywords main and news are checked.
When using direct selection the publishing web site does not appear in the Revive statistics. Is there a way to get listed on which sites the banners where seen?
You should use the regular Publishers/Zones approach instead.
Thanks for this very instructive article.
An invocation code example would be great.
How to invoke all banners of all campaigns through direct selection?
You can do it by either entering a specific banner id (bannerid:123) in the Banner Selection field, or by picking a particular campaign.
Not really sure what you mean by “all campaigns”.
Thanks for your reply. By all campaigns, I mean delivering all existing banners of all advertizers. Not just the banners of one specific campaign.
http://forum.revive-adserver.com/topic/302-direct-selection-of-all-campaigns/#entry1116
Thanks 😉
[…] This article was sourced from http://blackriver.to/2014/01/openx-source-revive-adserver-direct-selection/. […]