Skip to content

Instantly share code, notes, and snippets.

@tproenza
Created August 16, 2016 21:12
Show Gist options
  • Save tproenza/9b83d07a6e8a6f8b52ff255950a376a7 to your computer and use it in GitHub Desktop.
Save tproenza/9b83d07a6e8a6f8b52ff255950a376a7 to your computer and use it in GitHub Desktop.
/**
* Q: what is the difference between recurring and generated (also called 'onetime') reports?
* A: recurring reports are schedules that generate reports in the future (e.g. every Tuesday)
* A: generated reports are created immediately, one time
*
* Q: What are the params unique to recurring reports?
* A: The presence of `delivery_interval` indicates that the report is a recurring report
* There are three possible delivery_intervals: ('daily' || 'weekly' || 'monthly')
*
* if (report.delivery_interval === 'daily')
* unique param `schedule_time` passes value from the timepicker
* e.g. report.schedule_time: 18:00
* PLEASE NOTE: every ads report sends schedule_time (not sure why);
* it is hardcoded to 09:00 if not a daily report
*
* if (report.delivery_interval === 'weekly')
* unique param `day` for days of the week
* e.g. report.day: (1 || 2 || 3 || 4 || 5 || 6 || 7)
*
* if (report.delivery_interval === 'monthly')
* unique param `monthly` lets user choose first of month or middle of month
* e.g. report.month: ('first' || 'middle')
*
* Q: What are the params unique to generated reports?
* A: Each report has slightly different params
* (e.g. `metrics` for cust colum; `campaign_ids` for campaigns by campaign set)
* However, all generated reports are alike in that they send dates for the report to run
* (i.e. start_time / end_time with values in epoch)
* PLEASE NOTE: Recurring reports do not send start_time / end_time params
*
* ALSO NOTE: the generated Campaigns by Campaign Set report does not actually
* require a start_time, but the front-end sends one because the back-end expects it
*
* /
// ###############
// # SAMPLE PARAMS
// ###############
/**
* Customizable Columns [ONETIME]
*/
client_id:2083
end_time:1447863470
metrics:clicks,ctr,cpc,unique_clicks,uctr,cost_per_unique_click
report_type:campaign_overview
start_time:1445181470
title:
emails:jdrury@socialflow.com
service_user_id:364680820366006
account_type:facebook_page
detail_level:campaigns_ads
schedule_time:9:00
/**
* Customizable Columns [DAILY]
*/
client_id:2083
metrics:clicks,ctr,cpc,unique_clicks,uctr,cost_per_unique_click
report_type:campaign_overview
title:cust col daily
emails:jdrury@socialflow.com
period:month // cust column only: how far back to go (not sure if this is for data, or to find active campaigns)
service_user_id:364680820366006
schedule_time:14:00 // what time to run the report - REQUIRED FOR ALL RECURRING REPORTS
account_type:facebook_page
detail_level:campaigns_ads // this is always the same value for custom columns report
delivery_interval:daily // as opposed to weekly, or monthly - REQUIRED FOR ALL RECURRING REPORTS
/**
* Customizable Columns [WEEKLY]
*/
client_id:2083
metrics:clicks,ctr,cpc,unique_clicks,uctr,cost_per_unique_click
report_type:campaign_overview
title:cust col weekly
emails:jdrury@socialflow.com
period:month
service_user_id:364680820366006
schedule_time:9:00
account_type:facebook_page
detail_level:campaigns_ads
delivery_interval:weekly
day:2 //this param is only sent when daily_interval == weekly. 2 == tuesday, 3=== weds, etc
/**
* Customizable Columns [MONTHLY]
*/
client_id:2083
metrics:clicks,ctr,cpc,unique_clicks,uctr,cost_per_unique_click
report_type:campaign_overview
title:cust col monthly
emails:jdrury@socialflow.com
period:month
service_user_id:364680820366006
schedule_time:9:00
account_type:facebook_page
detail_level:campaigns_ads
delivery_interval:monthly
month:middle // only sent when deliv_inteval == monthly; can also be 'first'
// ###################
// ###################
/**
* Campaigns by Daterange [ONETIME]
*/
client_id:2083
end_time:1447863496
report_type:service_campaigns_weekly
start_time:1447258696
title:
emails:jdrury@socialflow.com
service_user_id:364680820366006
account_type:facebook_page
schedule_time:9:00
/**
* Campaigns by Daterange [DAILY]
*/
client_id:2083
report_type:service_campaigns_weekly
title:yolo
emails:jdrury@socialflow.com
service_user_id:364680820366006
schedule_time:14:00
account_type:facebook_page
delivery_interval:daily
/**
* Campaigns by Daterange [WEEKLY]
*/
client_id:2083
report_type:service_campaigns_weekly
title:campaigns weekly every week
emails:jdrury@socialflow.com
service_user_id:364680820366006
schedule_time:9:00
account_type:facebook_page
delivery_interval:weekly
day:2
// ###################
// ###################
/**
* Campaigns by Campaign Set [ONETIME]
*/
client_id:2083
report_type:selected_campaigns
start_time:1447863522 //start_time is not actually used by the back-end, but the back-end expects it
title:ha
emails:jdrury@socialflow.com
campaign_ids:993,13134,25613,29458
merge_into_sets:1
schedule_time:9:00
/**
* Campaigns by Campaign Set [DAILY]
*/
client_id:2083
report_type:selected_campaigns
title:yolo
emails:jdrury@socialflow.com
schedule_time:14:00
campaign_ids:13134,993,29458
merge_into_sets:1 //this option is hardcoded; it rolls the campaigns into one sheet by service (5 fb campaigns, 2 tw => 2 sheets)
delivery_interval:daily
/**
* Campaigns by Campaign Set [WEEKLY]
*/
client_id:2083
report_type:selected_campaigns
title:hi world
emails:jdrury@socialflow.com
schedule_time:9:00
campaign_ids:25252,993,29458,25613
merge_into_sets:1
delivery_interval:weekly
day:2
/**
* Campaigns by Campaign Set [MONTHLY]
*/
client_id:2083
report_type:selected_campaigns
title:last one
emails:jdrury@socialflow.com
schedule_time:9:00
campaign_ids:25252,25613,993,29458
merge_into_sets:1
delivery_interval:monthly
month:middle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment