public abstract class AdImpl extends Object implements Ad, Lot49Constants
AD_FILENAME_PREFIX, AUCTION_RESULTS_PATH_ADX, AUCTION_RESULTS_PATH_OPENX, AUCTION_RESULTS_PATH_PUBMATIC, BID_OUTCOME_CONTROL, BID_OUTCOME_INTERNAL_AUCTION_LOSS, BID_OUTCOME_SUBMITTED, BID_PRICE_CALCULATOR_FILENAME_PREFIX, COOKIE_PREFIX_A, DECISION_BIDS_MADE, DECISION_BIDS_NEEDED, DECISION_BIDS_POSSIBLE, DECISION_BRANDSAFETY, DECISION_BROWSER, DECISION_BUDGET, DECISION_CATEGORY, DECISION_DATE, DECISION_DAY, DECISION_DEVICE, DECISION_DOMAIN_REQUIRED, DECISION_DOMAIN_UNMATCHED, DECISION_EVALUATION_ERROR, DECISION_EXCHANGE, DECISION_EXPERIMENT_CONTROL_SET, DECISION_FLOOR, DECISION_FREQ_CAP, DECISION_GEO, DECISION_HOST, DECISION_HOUR, DECISION_INTEGRAL, DECISION_INTEGRAL_URL, DECISION_INTERNAL_AUCTION, DECISION_IP_BLACKLISTED, DECISION_LANGUAGE, DECISION_LOADING_ERROR, DECISION_NO_IMPRESSIONS, DECISION_NO_USER, DECISION_OS, DECISION_PACING, DECISION_PRIVATE_DEAL, DECISION_PROBABILITY, DECISION_PROVIDER, DECISION_SSP, DECISION_TAG, DECISION_TIMEOUT_EXPERIMENT_STATUS, DECISION_TIMEOUT_FC, DECISION_TIMEOUT_INTEGRAL, DECISION_TIMEOUT_UNKNOWN, DECISION_TIMEOUT_USERDATA, DECISION_TRAQ, DECISION_URL, DECISION_USER_UNKNOWN, DECISION_VALIDATION, DECISION_VIEWABILITY, DECISION_WRONG_USER, DEFAULT_CLICK_PATH_ABSOLUTE, DEFAULT_CLICK_PATH_RELATIVE, DEFAULT_IMPRESSION_PATH_ABSOLUTE, DEFAULT_IMPRESSION_PATH_RELATIVE, DEFAULT_NURL_PATH_ABSOLUTE, DEFAULT_NURL_PATH_RELATIVE, DEFAULT_PIXEL_PATH_ABSOLUTE, DEFAULT_PIXEL_PATH_RELATIVE, DEFAULT_PROUST_PATH_ABSOLUTE, DEFAULT_PROUST_PATH_RELATIVE, DEFAULT_REDIR_PATH_ABSOLUTE, DEFAULT_REDIR_PATH_RELATIVE, DEFAULT_TEST_PATH_RELATIVE, EXCHANGE_ADAPTV, EXCHANGE_ADX, EXCHANGE_BIDSWITCH, EXCHANGE_BRX, EXCHANGE_LIVERAIL, EXCHANGE_LOT49_INTERNAL_AUCTION, EXCHANGE_OPENX, EXCHANGE_PUBMATIC, EXCHANGE_SMAATO, EXCHANGE_SPOTXCHANGE, EXCHANGE_TEST1, EXCHANGE_TEST2, LOT49_VERSION_KEY, LOT49_VERSION_VALUE, MEDIA_TYPE_APPLICATION_JAVASCRIPT, MEDIA_TYPE_APPLICATION_SHOCKWAVE_FLASH, MEDIA_TYPE_VIDEO_FLV, MEDIA_TYPE_VIDEO_MP4, MOD_UID_COOKIE_LENGTH_MAX, MOD_UID_COOKIE_LENGTH_MIN, MOD_UID_LOG_LENGTH, NAME, NURL_ONLY_TAG, NURL_ONLY_WIN_NOTIFICATION, NURL_STANDART, QUERY_STRING_EXCHANGE_CLICK_THROUGH_ENCODED_MACRO, QUERY_STRING_EXCHANGE_CLICK_THROUGH_MACRO, QUERY_STRING_LOT49_CLICK_THROUGH_MACRO, REL_PATH_DEBUG_NURL, ROOT_PATH_ADMIN, ROOT_PATH_AUCTIONS, ROOT_PATH_STATS, TAG_DECISION_API, TAG_DECISION_DIMENSIONS, TAG_DECISION_DURATION, TAG_DECISION_MIME, TAG_DECISION_NOT_BANNER, TAG_DECISION_NOT_VIDEO, TAG_DECISION_PROTOCOL, TAG_DECISION_REQUEST_DISALLOWS_MARKUP, TAG_DECISION_SSL_REQUIRED, TAG_DECISION_VIDEO_LINEARITY, TAG_FILENAME_PREFIX, TEST_MOD_UID_COOKIE_1, TEST_MOD_UID_COOKIE_2, TEST_MOD_UID_COOKIE_3, TEST_MOD_UID_COOKIE_4, TEST_MOD_UID_LOG_1, TEST_MOD_UID_LOG_2, TEST_MOD_UID_LOG_3, TEST_MOD_UID_LOG_4
B_TOOK_CARE_OF_IT_ERROR, B_TOOK_CARE_OF_IT_LOSS, B_TOOK_CARE_OF_IT_WIN, BID_AMOUNT_DISPLAY_PREFIX, BID_AMOUNT_PREFIX, BID_COUNT_DISPLAY_PREFIX, BID_COUNT_PREFIX, BID_PREFIX, BID_PRICE_PREFIX, BID_REQUEST_PREFIX, BIDDER_COUNT_KEY, BUDGET_CHUNK_SIZE_PREFIX, BUDGET_MAP_KEY, BUDGET_PREFIX, BUDGET_UNLIMITED, COOKIE_TS_CLICK, COOKIE_TS_IMPRESSION, DEBUG_NURL_PREFIX, DECISION_DISPLAY_PREFIX, ENDS_ON_PREFIX, ENV_AWS_REGION, ENV_DYNAMO_ENDPOINT, ENV_EC2_ENDPOINT, ENV_ELB_ENDPOINT, ENV_LOT49_CONFIG_FILE, ENV_LOT49_HOME, ENV_LOT49_MAGIC, ENV_STS_ENDPOINT, LOWER_BID_PROBABILITY, NURL_PREFIX, OWNER_KEY_PREFIX, PACING_ASAP, PACING_LOG_PREFIX, PREFIX_VERSION, PREVIOUS_SPEND_AMOUNT_PREFIX, SEGMENT_PREFIX, SPEND_AMOUNT_DISPLAY_PREFIX, SPEND_AMOUNT_PREFIX, STARTS_ON_PREFIX, USER_DATA_SCORE_KEY, USER_PREFIX_V1, WIN_COUNT_DISPLAY_PREFIX, WIN_COUNT_PREFIX, WIN_RATE_STARTED_TS
API_MRAID, API_ORMMA, API_VPAID_1, API_VPAID_2, AUCTION_TYPE_FIRST_PRICE, AUCTION_TYPE_FIXED_PRICE, AUCTION_TYPE_SECOND_PRICE_PLUS, AUCTION_TYPE_UNKNOWN, BR_HTML5_1_0_VALUE, BR_HTML5_2_0_VALUE, CONNECTION_TYPE_CELL_2G, CONNECTION_TYPE_CELL_3G, CONNECTION_TYPE_CELL_4G, CONNECTION_TYPE_CELL_UNKNOWN, CONNECTION_TYPE_ETHERNET, CONNECTION_TYPE_UNKNOWN, CONNECTION_TYPE_WIFI, CONTENT_CONTEXT_APP, CONTENT_CONTEXT_GAME, CONTENT_CONTEXT_MUSIC, CONTENT_CONTEXT_OTHER, CONTENT_CONTEXT_TEXT, CONTENT_CONTEXT_UNKNOWN, CONTENT_CONTEXT_VIDEO, DEVICE_TYPE_CONNECTED_DEVICE, DEVICE_TYPE_CONNECTED_TV, DEVICE_TYPE_MOBILE_TABLET, DEVICE_TYPE_PC, DEVICE_TYPE_PHONE, DEVICE_TYPE_STB, DEVICE_TYPE_TABLET, ETHNICITY_AFRICAN_AMERICAN, ETHNICITY_ASIAN, ETHNICITY_HISPANIC, ETHNICITY_OTHER, ETHNICITY_WHITE, LINEARITY_LINEAR, LINEARITY_NON_LINEAR, MARITAL_DIVORCED, MARITAL_MARRIED, MARITAL_SINGLE, VIDEO_PLAYBACK_AUTO_SOUND_OFF, VIDEO_PLAYBACK_AUTO_SOUND_ON, VIDEO_PLAYBACK_CLICK_TO_PLAY, VIDEO_PLAYBACK_MOUSEOVER, VIDEO_PROTOCOL_VAST_1, VIDEO_PROTOCOL_VAST_2, VIDEO_PROTOCOL_VAST_3, VIDEO_PROTOCOL_VAST_WRAPPER_1, VIDEO_PROTOCOL_VAST_WRAPPER_2, VIDEO_PROTOCOL_VAST_WRAPPER_3
protected String nodeId
protected boolean domainRequired
protected Map<Provider,ProviderInfoRequired> providerTargeting
protected String clientId
private final AtomicLong winRate
private final AtomicLong bids
private final AtomicLong wins
protected String campaignId
protected String advertiser
private boolean unlimitedBudget
protected TargetingIntegral targetingIntegral
private DomainTargeting realDomainWhitelist
private DomainTargeting realDomainBlacklist
private AtomicLong projectedSpend
protected boolean abTesting
protected double abTestingShare
protected boolean campaignAbTesting
protected double campaignAbTestingShare
protected double abTestingControlShare
protected double campaignAbTestingControlShare
protected String advertiserId
protected AtomicLong budget
protected long bidPrice
private long lastBidTime
protected FrequencyCap frequencyCap
protected FrequencyCap frequencyCapCampaign
private int bidProbability
private long bidFrequency
protected String customUserData
protected String desc
protected String iurl
protected List<TargetingGeo> geos
protected List<TargetingGeo> negativeGeos
private String id
protected String name
private Random rnd
private Expression<String> parsedTargetingSegments
protected String targetingSegments
private AtomicLong requests
private AtomicLong remainingBidsToMake
private AtomicLong originalBidsToMake
private boolean testMode
protected final Map<String,Map<String,Object>> exchangeSpecificInstructions
private SortedMap<String,SortedMap<String,AtomicLong>> optoutsByExchange
private SortedMap<String,AtomicLong> bidsByExchange
private SortedMap<String,AtomicLong> requestsByExchange
private AtomicLong spendAmount
private AtomicLong bidAmount0
private ConcurrentMap<String,String> uniqOptoutReasonMap
protected String adVersion
private final long loadedOn
protected boolean segmentLogicAnd
protected BidPriceCalculator bidPriceCalculator
protected TargetingHour targetingHour
protected TargetingDOW targetingDOW
public static final String REGEXP_NON_ALPHANUM_WITH_WILDCARD
private final AtomicLong realBids
private final AtomicLong realWins
private AtomicLong realBidAmount
private AtomicLong realSpendAmount
private SortedMap<String,AtomicLong> realBidsByExchange
public AdImpl() throws Lot49Exception
Lot49Exception
public AdImpl(boolean testMode) throws Lot49Exception
Lot49Exception
public boolean isDomainRequired()
Ad
domain
be not null null in
order to bid.isDomainRequired
in interface Ad
public long getLoadedOn()
getLoadedOn
in interface Ad
public void addProviderTargeting(String providerName, String json) throws Lot49Exception
addProviderTargeting
in interface Ad
Lot49Exception
public Map<Provider,ProviderInfoRequired> getProviderTargeting()
getProviderTargeting
in interface Ad
public String getClientId()
Ad
getClientId
in interface Ad
ClientConfig
public double getWinRate()
Ad
getWinRate
in interface Ad
public void setWinRate(double wr)
setWinRate
in interface Ad
public Set<String> getOses()
Ad
public Set<Integer> getDeviceTypes()
getDeviceTypes
in interface Ad
public Set<String> getDeviceModels()
getDeviceModels
in interface Ad
public Set<String> getDeviceMakes()
getDeviceMakes
in interface Ad
public Set<String> getLanguages()
getLanguages
in interface Ad
public String getCampaignId()
Ad
getCampaignId
in interface Ad
public String getAdvertiser()
getAdvertiser
in interface Ad
public TargetingIntegral getTargetingIntegral()
getTargetingIntegral
in interface Ad
public void setTargetingIntegral(TargetingIntegral targetingIntegral)
public void setDomainWhitelistFromUrl(String urlStr)
setDomainWhitelistFromUrl
in interface Ad
public void setDomainBlacklistFromUrl(String urlStr)
setDomainBlacklistFromUrl
in interface Ad
public Set<String> getDomainWhitelist()
Ad
configuration option
.getDomainWhitelist
in interface Ad
public Set<String> getDomainBlacklist()
getDomainBlacklist
in interface Ad
public Map<String,Set<String>> getTargetingUrls()
Ad
configuration option
. Currently exact match is
required.getTargetingUrls
in interface Ad
public void setTargetingUrlsFromUrl(String urlStr)
setTargetingUrlsFromUrl
in interface Ad
public long getProjectedSpend()
getProjectedSpend
in interface Ad
public void setProjectedSpend(long n)
setProjectedSpend
in interface Ad
public Set<String> getTargetingCategories()
Ad
Site.getCat()
to target. Assumed to be normalized to upper case, with
colon separator for hierarchy. Targeting categories for page
,
section
, content
are not supported yet.getTargetingCategories
in interface Ad
public List<String> validate()
Ad
public boolean doAbTesting()
doAbTesting
in interface Ad
public boolean doTargetingStrategyAbTesting()
doTargetingStrategyAbTesting
in interface Ad
public boolean doCampaignAbTesting()
doCampaignAbTesting
in interface Ad
public double getTargetingStrategyAbTestingShare()
getTargetingStrategyAbTestingShare
in interface Ad
public double getCampaignAbTestingShare()
getCampaignAbTestingShare
in interface Ad
public double getAbTestingControlShare()
getAbTestingControlShare
in interface Ad
public double getCampaignAbTestingControlShare()
getCampaignAbTestingControlShare
in interface Ad
public List<String> getAdomain()
getAdomain
in interface Ad
Bid.getAdomain()
public String getAdvertiserId()
getAdvertiserId
in interface Ad
public boolean allocateBudget(OpenRtbRequest req)
public List<String> getLandingPageUrls()
getLandingPageUrls
in interface Ad
public long getLastBidTime()
getLastBidTime
in interface Ad
public void setLastBidTime(long lastBidTime)
setLastBidTime
in interface Ad
public void setFrequencyCap(FrequencyCap fc)
setFrequencyCap
in interface Ad
public FrequencyCap getFrequencyCap()
getFrequencyCap
in interface Ad
public void setFrequencyCapCampaign(FrequencyCap fcCampaign)
setFrequencyCapCampaign
in interface Ad
public FrequencyCap getFrequencyCapCampaign()
getFrequencyCapCampaign
in interface Ad
public long getBidFrequency()
Ad
getBidFrequency
in interface Ad
Ad.getBidProbability()
public void setBidFrequency(long bidFrequency)
setBidFrequency
in interface Ad
Ad.getBidFrequency()
public void setBidProbability(int bidProbability)
setBidProbability
in interface Ad
Ad.getBidProbability()
public Set<String> getBrowsers()
getBrowsers
in interface Ad
public boolean checkMeasurementSegments(UserSegments userSegments)
checkMeasurementSegments
in interface Ad
@Deprecated public void setUserSegments(Set<String> segments)
public Expression<String> getParsedTargetingSegments()
getParsedTargetingSegments
in interface Ad
protected void setTargetingSegments(String expression) throws Lot49Exception
Lot49Exception
protected Or<String> or(Expression<String>... terms)
protected And<String> and(Expression<String>... terms)
protected Not<String> not(Expression<String> term)
public Set<String> getExchanges()
getExchanges
in interface Ad
public void incrRequestCount(String exchange)
incrRequestCount
in interface Ad
public void incrRequestCount(String exchange, long n)
incrRequestCount
in interface Ad
public long getRequestCount()
getRequestCount
in interface Ad
public long getRequestCount(String exchange)
getRequestCount
in interface Ad
public boolean haveBidsToMake()
Ad
set
per current
pacing period by AdCache
, and every time we make a bid, we decrement the allowed
amount.haveBidsToMake
in interface Ad
public long getRemainingBidsToMake()
getRemainingBidsToMake
in interface Ad
public long getOriginalBidsToMake()
getOriginalBidsToMake
in interface Ad
public void setBidsToMake(long bidsToMake)
setBidsToMake
in interface Ad
public Map<String,Map<String,Object>> getExchangeSpecificInstructions()
Ad
exchange name
, for those exchanges that
return non-null in ExchangeAdapter.makeExchangeSpecificInstructionsMap()
, to that
Map. It is returned with keys only for ever Ad object, and is checked by the Exchange during
response conversion phase
.getExchangeSpecificInstructions
in interface Ad
private static final SortedMap<String,AtomicLong> makeSingleExchangeOptoutMap()
public SortedMap<String,AtomicLong> getBidsByExchange()
getBidsByExchange
in interface Ad
public SortedMap<String,AtomicLong> getRequestsByExchange()
getRequestsByExchange
in interface Ad
public long getSpendAmount()
getSpendAmount
in interface Ad
public void incrSpendAmount(long n)
incrSpendAmount
in interface Ad
public long getBidAmount()
getBidAmount
in interface Ad
public void incrOptout(OpenRtbRequest req, String name)
incrOptout
in interface Ad
public void incrOptout(OpenRtbRequest req, String name, long n)
incrOptout
in interface Ad
public String getAdVersion()
getAdVersion
in interface Ad
boolean matchOrganizations(Geo lot49Geo)
public Map<String,Set<String>> getTargetingDeals()
getTargetingDeals
in interface Ad
getTargetingDeals()
public void setTargetingDeals(Map<String,List<String>> deals)
exchange name
to list of targeted Deal IDssetTargetingDeals
in interface Ad
PMP
,
Deal
public boolean checkIntegralTargeting(OpenRtbRequest req, Site site, IntegralInfoReceived integralInfoReceived)
checkIntegralTargeting
in interface Ad
public boolean matchTargetingUrls(OpenRtbRequest req, Site site)
public boolean isTargetingDeals()
isTargetingDeals
in interface Ad
public String matchDeals(OpenRtbRequest br, Impression imp)
matchDeals
in interface Ad
br
- requestimp
- impressionpublic boolean matchDomainTargeting(OpenRtbRequest br)
public boolean canBid1(OpenRtbRequest br)
Ad
constituent config
's
canBid()
methods. This only qualifies the bid
request's attributes (including user) in absence of a particular ad tag configuration. Thus,
on a test bid, all of these methods can be assumed to be true, but not all
canBid()s
.Lot49Ext.getLot49ExtRemote()
is populated.This will always return true if bidRequest
is a
test request
.public boolean isSegmentLogicAnd()
isSegmentLogicAnd
in interface Ad
public boolean checkSegments(OpenRtbRequest br, UserSegments userSegments)
Return false if:
we have targeted segments
and the intersection of it with
looked up segments
is empty.checkSegments
in interface Ad
Ad.canBid1(com.enremmeta.rtb.api.proto.openrtb.OpenRtbRequest)
public boolean checkFrequencyCap(OpenRtbRequest br, UserFrequencyCapAttributes userFrequencyCap)
checkFrequencyCap
in interface Ad
public SortedMap<String,SortedMap<String,AtomicLong>> getOptoutsByExchange()
getOptoutsByExchange
in interface Ad
public void setBidPrice(long n)
setBidPrice
in interface Ad
protected void setBidAmount(long n)
public long getBidPrice(OpenRtbRequest req)
Ad
getBidPrice
in interface Ad
public void setBidPriceCalculator(BidPriceCalculator bpc)
setBidPriceCalculator
in interface Ad
public BidPriceCalculator getBidPriceCalculator()
getBidPriceCalculator
in interface Ad
public boolean isDynamicPricing()
isDynamicPricing
in interface Ad
public double getBidPriceCpm(OpenRtbRequest req)
Ad
Ad.getBidAmount()
but as $ CPM.getBidPriceCpm
in interface Ad
public int getBidProbability()
Ad
Ad.getBidFrequency()
. Values below 0 and above 100 work
the same as 0 and 100 respectively.getBidProbability
in interface Ad
Ad.getBidFrequency()
private final long getCachebuster()
public String getCustomUserData()
public List<TargetingGeo> getGeos()
public List<TargetingGeo> getNegativeGeos()
getNegativeGeos
in interface Ad
public String getId()
Ad
getId
in interface Ad
getId
in interface Lot49Plugin
public String getName()
Ad
getName
in interface Ad
getName
in interface Lot49Plugin
public Random getRnd()
public Tag findTagById(String id)
Ad
findTagById
in interface Ad
id
- tag identifier we interested in@Deprecated public Set<String> getUserSegments()
getUserSegments
in interface Ad
public boolean needUserInfo()
needUserInfo
in interface Ad
public boolean needFrequencyCap()
needFrequencyCap
in interface Ad
public boolean needIntegralInfo()
needIntegralInfo
in interface Ad
public boolean needExperimentInfo()
needExperimentInfo
in interface Ad
public boolean isCampaignFrequencyCap()
isCampaignFrequencyCap
in interface Ad
public boolean isStrategyFrequencyCap()
isStrategyFrequencyCap
in interface Ad
public boolean needCanBid2()
needCanBid2
in interface Ad
public TargetingHour getTargetingHour()
Ad
Ad.getBidProbability()
, which is used for pacing purposes, this
probability is for A/B testing.getTargetingHour
in interface Ad
public TargetingDOW getTargetingDOW()
getTargetingDOW
in interface Ad
public void setOrganizations(Collection<String> o)
public Set<Pattern> getOrganizations()
getOrganizations
in interface Ad
public long getRealBids()
getRealBids
in interface Ad
public long getRealWins()
getRealWins
in interface Ad
public SortedMap<String,AtomicLong> getRealBidsByExchange()
getRealBidsByExchange
in interface Ad
public long getRealSpendAmount()
getRealSpendAmount
in interface Ad
public long getRealBidAmount()
getRealBidAmount
in interface Ad
public void storeAdState()
storeAdState
in interface Ad