001    /*
002    Copyright (c) 1996-2011, Damon Hart-Davis
003    All rights reserved.
004    
005    Redistribution and use in source and binary forms, with or without
006    modification, are permitted provided that the following conditions are
007    met:
008    
009      * Redistributions of source code must retain the above copyright
010        notice, this list of conditions and the following disclaimer.
011    
012      * Redistributions in binary form must reproduce the above copyright
013        notice, this list of conditions and the following disclaimer in the
014        documentation and/or other materials provided with the
015        distribution.
016    
017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
018    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
019    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
020    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
021    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
022    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
023    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
024    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
025    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
026    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
027    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028    */
029    
030    package org.hd.d.pg2k.webSvr.ads;
031    
032    
033    
034    /**Advertising-related constants.
035     */
036    public final class AdConsts
037        {
038        /**Prevent construction of an instance. */
039        private AdConsts() { }
040    
041        /**If true, support Web advertising in the Gallery.
042         * This includes Google AdSense and TribalFusion for example.
043         * <p>
044         * This may include things such as in-line banners,
045         * adjusted page layout,
046         * click-through monitoring, etc.
047         * <p>
048         * With this false, such special support is removed,
049         * and ads are limited to whatever is included in general
050         * banner rotations, etc.
051         */
052        public static final boolean AD_SUPPORT = true;
053    
054        /**If true then try to capture/sample AdSense clickthroughs.
055         * As of the end of 2008 this hasn't been possible..
056         */
057        public static final boolean TRACK_AS_CLICKTHROUGHS = false;
058    
059        /**If true then try to dynamically choose ad network (and page layout) based on performance.
060         * If we cannot capture live(ish) clickthrough data then this should be false
061         * unless we can present some reasonable static eCPM data (via the GenProps).
062         * <p>
063         * This may also have the effect of avoiding some 'reduced advertising' layouts.
064         */
065        public static final boolean DYNAMICALLY_CHOOSE_AD_NETWORK = false;
066    
067        /**Drop more ads on poorly-performing pages.
068         * This means that we might show alternative interesting content
069         * rather than even trying to show an ad.
070         * <p>
071         * This also needs a run-time property to be set to be effective.
072         * <p>
073         * We may do this to help reduce ad blindness
074         * and to increase CTR for advertisers
075         * (and thus eCPM for us long-term possibly).
076         */
077        public static final boolean DROP_MORE_ADS_FOR_ALT_CONTENT = true;
078    
079        /**If true then show no or fewer ads on first page that a user sees, whichever it is.
080         * This may improve page-load speed
081         * and the user's general perception of the site,
082         * but may reduce ad revenue such as from single-page visitors.
083         */
084        public static final boolean DROP_ADS_ON_FIRST_PAGE_VIEW = true;
085    
086        /**If true, enable eShirt link/ads. */
087        public static final boolean ENABLE_ESHIRT = false;
088    
089        /**If true then enable conversion tracking of ads for the Gallery. */
090        public static final boolean ENABLE_CONV_TRACKING = true;
091    
092        /**If true, enable AdBrite ad slots. */
093        public static final boolean ENABLE_ADBRITE = false;
094    
095        /**If true, enable TribalFusion ad slots. */
096        public static final boolean ENABLE_TRIBALFUSION = true;
097    
098        /**If true, enable Casale Media ad slots. */
099        public static final boolean ENABLE_CASALEMEDIA = false;
100    
101        /**Maximum number of Google AdSense AdUnits (not including AdLinks) allowed on one page. */
102        public static final int ADSENSE_MAX_ADUNITS = 3;
103    
104        /**Request property name that holds AdTowerPos tower layout, if any, for current page. */
105        public static final String RQPNAME_TOWERPOS = "towerPos";
106    
107        /**Prefix in global event set for layoutStyle parameter to capture name of click-through in given page layout. */
108        public static final String LAYOUT_STYLE_EVENT_PREFIX = "ctLayoutStyle=";
109    
110        /**Prefix in global event set of ad/page layout page-view name. */
111        public static final String PAGE_LAYOUT_KHITS_EVENT_PREFIX = "kPLV=";
112    
113        /**Request property name that holds String name of page/ad, if any, for current page. */
114        public static final String RQPNAME_PAGELAYOUT = "PageLayout";
115    
116        /**Request property name that holds String name of (last) internal tower layout, if any, for current page. */
117        public static final String RQPNAME_TOWERINTLAYOUT = "TowerIntLayout";
118    
119        /**Prefix in global event set for click-through when in given internal tower layout. */
120        public static final String TOWERINTLAYOUT_EVENT_PREFIX = "ct" + RQPNAME_TOWERINTLAYOUT + '=';
121    
122        /**Prefix in global event set of tower-ad internal layout page-view name. */
123        public static final String TOWERINTLAYOUT_KHITS_EVENT_PREFIX = "kPTILV=";
124    
125        /**Request property name that holds String name of (last) internal mid-page layout, if any, for current page. */
126        public static final String RQPNAME_MPINTLAYOUT = "MPIntLayout";
127    
128        /**Prefix in global event set for click-through when in given internal mid-page layout. */
129        public static final String MPINTLAYOUT_EVENT_PREFIX = "ct" + RQPNAME_MPINTLAYOUT + '=';
130    
131        /**Prefix in global event set of mid-page-ad internal layout page-view name. */
132        public static final String MPINTLAYOUT_KHITS_EVENT_PREFIX = "kPMPILV=";
133    
134        /**Name of request-level attribute to indicate that we've voluntarily dropped a G AdLink unit if set non-null.
135         * This means that the unit is available to another position on the page.
136         * Whatever code mops up and displays the available link-unit should unset the attribute
137         */
138        public static final String ASLU_AVAILABLE_REQ_ATTR_NAME = "org.hd.d.pg2k.webSvr.ads.ALUNITAVAIL";
139    
140    
141        /**Target minimum 'information' words per display ad on each page; strictly positive.
142         * The aim of this is to avoid swamping a page with too many ads against very thin text.
143         * <p>
144         * Standard boilerplate/furniture words should be excluded from this measure,
145         * as they don't add 'information' or real 'content' to the page.
146         * <p>
147         * Code may be marginally more efficient if this value is a power of 2.
148         */
149        public static final int TARGET_MIN_WORDS_PER_AD_BLOCK = 128;
150    
151        /**Maximum server-side ad insertion wait in milliseconds; non-negative.
152         * We won't delay page generation by more than this (in total)
153         * on server-side inserted ads.
154         * <p>
155         * May allow slightly more efficient code if a power of two.
156         */
157        public static final int MAX_SS_AD_WAIT_MS = 512;
158        }