Created
July 16, 2014 18:52
-
-
Save oivoodoo/3db7816793e5f14b9604 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module V2 | |
class ReportByCampaign < BaseReport | |
report 'campaign' do | |
attach_to DailyEventAd, as: 'ads' do | |
# We are using columns for resolving dynamic columns on rows | |
columns COLUMNS | |
# Fields Mapping is linking columns fields and row fields | |
mapping AD_FIELDS | |
filter promoted_app_id: ->(report) { { '$in' => report.app_ids } }, | |
campaign_id: ->(report) { { '$exists' => true, '$ne' => nil } } | |
group_by :campaign_id | |
column :campaign_name, :impressions_received, :installs_received, | |
:clicks_received, :conv_rate, :clicks_thru_rate | |
end | |
end | |
report 'day' do | |
attach_to DailyEventAd, as: 'ads' do | |
# We are using columns for resolving dynamic columns on rows | |
columns COLUMNS | |
# Fields Mapping is linking columns fields and row fields | |
mapping AD_FIELDS | |
filter promoted_app_id: ->(report) { { '$in' => report.app_ids } }, | |
campaign_id: ->(report) { { '$exists' => true, '$ne' => nil } } | |
group_by :day, :campaign_id | |
column :day, :impressions_received, :installs_received, | |
:clicks_received, :conv_rate, :clicks_thru_rate | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment