Skip to content

Instantly share code, notes, and snippets.

@adstage-david
Created December 7, 2016 20:48
Show Gist options
  • Save adstage-david/16e6888de4b255d36fe20d1cf0dbe5b0 to your computer and use it in GitHub Desktop.
Save adstage-david/16e6888de4b255d36fe20d1cf0dbe5b0 to your computer and use it in GitHub Desktop.
(do
(def
week-over-week-performance-summary
{:compare-to "previous_period",
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/table},
:filters [],
:fields ["spend" "clicks" "ctr"],
:layout-order nil,
:width "12",
:type {:db/ident :widget.type/metric},
:targets nil,
:title "Week Over Week Performance Summary",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_visible},
:list-name "network_campaigns",
:profile-id nil,
:search-type nil,
:order {:db/ident :data-source.order/desc},
:timeframe "default",
:sort-by "clicks",
:target "/api/users/40",
:aggregate nil,
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
ctr-by-week
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/time-series},
:filters [],
:fields ["ctr"],
:layout-order nil,
:width "8",
:type {:db/ident :widget.type/line-chart},
:targets ["/api/organizations/40"],
:title "CTR by Week",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines
[{:value "2", :text "Target"} {:value ".5", :text "Below Goal"}],
:status {:db/ident :data-source.status/all_visible},
:list-name "network_campaigns",
:profile-id nil,
:search-type "cross-network",
:order {:db/ident :data-source.order/desc},
:timeframe "last_30_days",
:sort-by "clicks",
:target "/api/users/40",
:aggregate {:db/ident :data-source.aggregate/week},
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
conversions-by-network-last-week
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/time-series},
:filters [],
:fields ["conversions"],
:layout-order nil,
:width "4",
:type {:db/ident :widget.type/pie-chart},
:targets ["/api/organizations/40"],
:title "Conversions by Network Last Week",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_visible},
:list-name "network_campaigns",
:profile-id nil,
:search-type "cross-network",
:order {:db/ident :data-source.order/desc},
:timeframe "default",
:sort-by "clicks",
:target "/api/users/40",
:aggregate {:db/ident :data-source.aggregate/day},
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
impressions-and-clicks-by-week
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/time-series},
:filters [],
:fields ["impressions" "clicks"],
:layout-order nil,
:width "12",
:type {:db/ident :widget.type/bar-chart},
:targets ["/api/organizations/40"],
:title "Impressions and Clicks by Week",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_visible},
:list-name "specify_range",
:profile-id nil,
:search-type "cross-network",
:order {:db/ident :data-source.order/desc},
:timeframe "last_30_days",
:sort-by "clicks",
:target "/api/users/40",
:aggregate {:db/ident :data-source.aggregate/week},
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
spend-to-monthly-target
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/time-series},
:filters [],
:fields ["spend"],
:layout-order nil,
:width "4",
:type {:db/ident :widget.type/gauge-chart},
:targets nil,
:title "Spend to Monthly Target",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_visible},
:list-name "network_campaigns",
:profile-id nil,
:search-type "cross-network",
:order {:db/ident :data-source.order/desc},
:timeframe "this_1_month",
:sort-by "clicks",
:target "/api/users/40",
:aggregate {:db/ident :data-source.aggregate/day},
:provider {:db/ident :data-source.provider/platform},
:progress-goal "20000"})
(def
spend-by-week-vs-last-year
{:compare-to "previous_year",
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/time-series},
:filters [{:path "spend", :value 0, :op "gt"}],
:fields ["spend"],
:layout-order nil,
:width "8",
:type {:db/ident :widget.type/bar-chart},
:targets ["/api/organizations/40"],
:title "Spend by Week vs Last Year",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [{:value "2000", :text "Weekly Spend Target"}],
:status {:db/ident :data-source.status/all_visible},
:list-name "network_campaigns",
:profile-id nil,
:search-type "cross-network",
:order {:db/ident :data-source.order/desc},
:timeframe "last_30_days",
:sort-by "clicks",
:target "/api/users/40",
:aggregate {:db/ident :data-source.aggregate/week},
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
top-10-active-campaigns-last-week-by-spend
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/table},
:filters [],
:fields
["campaign_name"
"account_name"
"network"
"spend"
"clicks"
"impressions"
"cpc"
"cpm"
"ctr"
"budget"],
:layout-order nil,
:width "12",
:type {:db/ident :widget.type/table},
:targets nil,
:title "Top 10 Active Campaigns Last Week by Spend",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_active},
:list-name "network_campaigns",
:profile-id nil,
:search-type nil,
:order {:db/ident :data-source.order/desc},
:timeframe "default",
:sort-by "spend",
:target "/api/users/40",
:aggregate nil,
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""})
(def
top-10-active-adgroups-last-week-by-ctr-with-impressions->-100
{:compare-to nil,
:target-label nil,
:limit 10,
:response-type {:db/ident :data-source.response-type/table},
:filters [{:path "impressions", :value 100, :op "gt"}],
:fields
["account_name"
"campaign_name"
"network"
"ctr"
"spend"
"clicks"
"impressions"
"cpm"
"cpc"
"conversions"
"conversion_rate"
"cpa"],
:layout-order nil,
:width "12",
:type {:db/ident :widget.type/table},
:targets nil,
:title
"Top 10 Active AdGroups Last Week by CTR with Impressions > 100",
:primary-dimension nil,
:secondary-dimension nil,
:networks ["adwords" "bing_ads" "facebook" "linkedin" "twitter"],
:y-grid-lines [],
:status {:db/ident :data-source.status/all_active},
:list-name "network_ad_groups",
:profile-id nil,
:search-type nil,
:order {:db/ident :data-source.order/desc},
:timeframe "default",
:sort-by "ctr",
:target "/api/users/40",
:aggregate nil,
:provider {:db/ident :data-source.provider/platform},
:progress-goal ""}))
(defn
dash
[]
(let
[dash-id
(om/tempid)
w
(fn*
[]
(->
{:id (om/tempid),
:dash-id dash-id,
:data-source-id (om/tempid)}))]
{:id dash-id,
:frequency {:db/ident :schedule.frequency/never},
:schedule-id (om/tempid),
:title "Cross-Network Weekly Summary",
:fee-markup "0",
:widgets
[(assoc (w) :form-fields week-over-week-performance-summary)
(assoc (w) :form-fields ctr-by-week)
(assoc (w) :form-fields conversions-by-network-last-week)
(assoc (w) :form-fields impressions-and-clicks-by-week)
(assoc (w) :form-fields spend-to-monthly-target)
(assoc (w) :form-fields spend-by-week-vs-last-year)
(assoc
(w)
:form-fields
top-10-active-campaigns-last-week-by-spend)
(assoc
(w)
:form-fields
top-10-active-adgroups-last-week-by-ctr-with-impressions->-100)]}))
(defn
template
[]
{:dash (dash),
:title "Cross-Network Weekly Summary",
:description "lorep ipsum",
:timeframe "last_1_week",
:image "STUB.jpg"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment