## The contents of this file are subject to the Common Public Attribution ## License Version 1.0. (the "License"); you may not use this file except in ## compliance with the License. You may obtain a copy of the License at ## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public ## License Version 1.1, but Sections 14 and 15 have been added to cover use of ## software over a computer network and provide for limited attribution for the ## Original Developer. In addition, Exhibit A has been modified to be ## consistent with Exhibit B. ## ## Software distributed under the License is distributed on an "AS IS" basis, ## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for ## the specific language governing rights and limitations under the License. ## ## The Original Code is reddit. ## ## The Original Developer is the Initial Developer. The Initial Developer of ## the Original Code is reddit Inc. ## ## All portions of the code written by reddit are Copyright (c) 2006-2012 ## reddit Inc. All Rights Reserved. ############################################################################### <%! from r2.lib.template_helpers import static, format_number from r2.lib import js import datetime from r2.lib import promote import babel.numbers locale = c.locale def num(x): return format_number(x, locale) def money(x): return babel.numbers.format_currency(x, 'USD', locale) %> <%namespace file="reddittraffic.html" import="load_timeseries_js"/> ${load_timeseries_js()}

${_("Sponsored link calendar")}

%if not c.user_is_sponsor:

Below is a calendar of your scheduled and completed promotions (if you have any, of course), along with some site-wide averages to use as a guide for setting up future promotions. These values are:

Count:
Total number of sponsored links which either ran or are scheduled to run (site-wide).
CPM:
Cost per thousand impressions (site-wide). Note that today's CPM is estimated.
CPC:
Cost per click, also site-wide and with the same caveat about today's value
your commit:
Total amount you have spent or have scheduled to spend on a given day
%endif <% max_percent = 97. %>
<% today = thing.now.date() %>
DATE
COUNT
%if c.user_is_sponsor: IMPRESSIONS
%endif CPM
%if c.user_is_sponsor: CLICKS
%endif CPC
%if c.user_is_sponsor: TOTAL COMMIT %else: YOUR COMMIT %endif
%for i in xrange(thing.total_size): <% left = "%.2f" % (max_percent*float(i+1)/(thing.total_size+1)) right = "%.2f" % (100 - max_percent*float(i+2)/(thing.total_size+1)) day = thing.start_date + datetime.timedelta(i) CPC = CPM = imp_traffic = cli_traffic = "---" if thing.promo_traffic.has_key(day): imp_traffic, cli_traffic = thing.promo_traffic[day] if thing.market.has_key(i) and day < today: CPM = "$%.2f" % (thing.market[i] * 1000./max(imp_traffic, 1)) CPC = "$%.2f" % (thing.market[i] * 1./max(cli_traffic, 1)) imp_traffic = num(imp_traffic) cli_traffic = num(cli_traffic) if day == today: imp_traffic = "(%s)" % imp_traffic cli_traffic = "(%s)" % cli_traffic %>
${day}
${thing.promo_counter.get(i, unsafe(" "))}
%if c.user_is_sponsor: ${imp_traffic}
%endif ${CPM}
%if c.user_is_sponsor: ${cli_traffic}
%endif ${CPC}
${"$%.2f" % thing.my_market[i] if thing.my_market.has_key(i) else "---"}
%endfor <% prev_end = 0 %> %for link, bid, start, end, indx in thing.promote_blocks: <% start += 1 end += 1 sr = '' if indx in getattr(link, "campaigns", {}): sr = link.campaigns[indx][promote.CAMPAIGN.sr] if sr: sr += ':' %> %if start != end: %if prev_end > start: <% prev_end = 0 %>
%endif <% margin = "%.2f" % (float(max_percent*(start-prev_end))/(thing.total_size+1)) width = "%.2f" % (float(max_percent*(end-start))/(thing.total_size+1)) prev_end = end %> %endif %endfor

${_("historical site performance")}

${thing.performance_table}