@@ -127,7 +127,8 @@ def load_next_page(self):
127
127
if self ._finished_iteration :
128
128
return False
129
129
130
- self ._params ['summary' ] = True
130
+ if 'summary' not in self ._params :
131
+ self ._params ['summary' ] = True
131
132
132
133
response = self ._source_object .get_api_assured ().call (
133
134
'GET' ,
@@ -804,6 +805,7 @@ class Field(object):
804
805
agency_client_declaration = 'agency_client_declaration'
805
806
amount_spent = 'amount_spent'
806
807
balance = 'balance'
808
+ business = 'business'
807
809
business_city = 'business_city'
808
810
business_country_code = 'business_country_code'
809
811
business_name = 'business_name'
@@ -941,6 +943,11 @@ def get_ad_images(self, fields=None, params=None):
941
943
"""Returns iterator over AdImage's associated with this account."""
942
944
return self .iterate_edge (AdImage , fields , params )
943
945
946
+ def get_insights (self , fields = None , params = None ):
947
+ params = params or {}
948
+ params ['summary' ] = params .get ('summary' )
949
+ return self .iterate_edge (Insights , fields , params )
950
+
944
951
def get_broad_category_targeting (self , fields = None , params = None ):
945
952
"""
946
953
Returns iterator over BroadCategoryTargeting's associated with this
@@ -1125,6 +1132,11 @@ def get_stats(self, fields=None, params=None):
1125
1132
"""Returns iterator over AdStat's associated with this campaign."""
1126
1133
return self .iterate_edge (AdStats , fields , params )
1127
1134
1135
+ def get_insights (self , fields = None , params = None ):
1136
+ params = params or {}
1137
+ params ['summary' ] = params .get ('summary' )
1138
+ return self .iterate_edge (Insights , fields , params )
1139
+
1128
1140
1129
1141
class AdSet (CanValidate , HasStatus , CanArchive , AbstractCrudObject ):
1130
1142
@@ -1175,6 +1187,11 @@ def get_stats(self, fields=None, params=None):
1175
1187
"""Returns iterator over AdStat's associated with this set."""
1176
1188
return self .iterate_edge (AdStats , fields , params )
1177
1189
1190
+ def get_insights (self , fields = None , params = None ):
1191
+ params = params or {}
1192
+ params ['summary' ] = params .get ('summary' )
1193
+ return self .iterate_edge (Insights , fields , params )
1194
+
1178
1195
1179
1196
class AdGroup (HasStatus , HasObjective , CanArchive , AbstractCrudObject ):
1180
1197
@@ -1187,11 +1204,9 @@ class Field(HasBidInfo, object):
1187
1204
conversion_specs = 'conversion_specs'
1188
1205
created_time = 'created_time'
1189
1206
creative = 'creative'
1190
- creative_ids = 'creative_ids'
1191
1207
failed_delivery_checks = 'failed_delivery_checks'
1192
1208
id = 'id'
1193
1209
name = 'name'
1194
- objective = 'objective'
1195
1210
redownload = 'redownload'
1196
1211
social_prefs = 'social_prefs'
1197
1212
status = 'adgroup_status'
@@ -1240,6 +1255,11 @@ def get_conversion_stats(self, fields=None, params=None):
1240
1255
"""Returns ConversionStats object associated with this ad."""
1241
1256
return self .edge_object (ConversionStats , fields , params )
1242
1257
1258
+ def get_insights (self , fields = None , params = None ):
1259
+ params = params or {}
1260
+ params ['summary' ] = params .get ('summary' )
1261
+ return self .iterate_edge (Insights , fields , params )
1262
+
1243
1263
1244
1264
class AdConversionPixel (AbstractCrudObject ):
1245
1265
@@ -2037,7 +2057,7 @@ def get_endpoint(cls):
2037
2057
return 'transactions'
2038
2058
2039
2059
2040
- class Business (AbstractCrudObject , CannotCreate , CannotDelete ):
2060
+ class Business (CannotCreate , CannotDelete , AbstractCrudObject ):
2041
2061
2042
2062
class Field (object ):
2043
2063
created_by = 'created_by'
@@ -2053,6 +2073,11 @@ class Field(object):
2053
2073
def get_product_catalogs (self , fields = None , params = None ):
2054
2074
return self .iterate_edge (ProductCatalog , fields , params )
2055
2075
2076
+ def get_insights (self , fields = None , params = None ):
2077
+ params = params or {}
2078
+ params ['summary' ] = params .get ('summary' )
2079
+ return self .iterate_edge (Insights , fields , params )
2080
+
2056
2081
2057
2082
class ProductCatalog (AbstractCrudObject ):
2058
2083
@@ -2308,3 +2333,136 @@ class Field(object):
2308
2333
@classmethod
2309
2334
def get_endpoint (cls ):
2310
2335
return 'product_audiences'
2336
+
2337
+
2338
+ class Insights (CannotCreate , CannotDelete , CannotUpdate , AbstractCrudObject ):
2339
+ class Field (object ):
2340
+ account_id = 'account_id'
2341
+ account_name = 'account_name'
2342
+ action_values = 'action_values'
2343
+ actions = 'actions'
2344
+ actions_per_impression = 'actions_per_impression'
2345
+ adgroup_id = 'adgroup_id'
2346
+ adgroup_name = 'adgroup_name'
2347
+ async_percent_completion = 'async_percent_completion'
2348
+ async_status = 'async_status'
2349
+ campaign_end = 'campaign_end'
2350
+ campaign_group_end = 'campaign_group_end'
2351
+ campaign_group_id = 'campaign_group_id'
2352
+ campaign_group_name = 'campaign_group_name'
2353
+ campaign_id = 'campaign_id'
2354
+ campaign_name = 'campaign_name'
2355
+ campaign_start = 'campaign_start'
2356
+ clicks = 'clicks'
2357
+ cost_per_action_type = 'cost_per_action_type'
2358
+ cost_per_result = 'cost_per_result'
2359
+ cost_per_total_action = 'cost_per_total_action'
2360
+ cost_per_unique_click = 'cost_per_unique_click'
2361
+ cpc = 'cpc'
2362
+ cpm = 'cpm'
2363
+ cpp = 'cpp'
2364
+ ctr = 'ctr'
2365
+ date_start = 'date_start'
2366
+ date_stop = 'date_stop'
2367
+ frequency = 'frequency'
2368
+ id = 'id'
2369
+ impressions = 'impressions'
2370
+ objective = 'objective'
2371
+ reach = 'reach'
2372
+ relevance_score = 'relevance_score'
2373
+ report_run_id = 'report_run_id'
2374
+ result_rate = 'result_rate'
2375
+ results = 'results'
2376
+ roas = 'roas'
2377
+ social_clicks = 'social_clicks'
2378
+ social_impressions = 'social_impressions'
2379
+ social_reach = 'social_reach'
2380
+ spend = 'spend'
2381
+ today_spend = 'today_spend'
2382
+ total_action_value = 'total_action_value'
2383
+ total_actions = 'total_actions'
2384
+ total_unique_actions = 'total_unique_actions'
2385
+ unique_clicks = 'unique_clicks'
2386
+ unique_ctr = 'unique_ctr'
2387
+ unique_social_clicks = 'unique_social_clicks'
2388
+ video_avg_pct_watched_actions = 'video_avg_pct_watched_actions'
2389
+ video_avg_sec_watched_actions = 'video_avg_sec_watched_actions'
2390
+ video_complete_watched_actions = 'video_complete_watched_actions'
2391
+ video_p100_watched_actions = 'video_p100_watched_actions'
2392
+ video_p25_watched_actions = 'video_p25_watched_actions'
2393
+ video_p50_watched_actions = 'video_p50_watched_actions'
2394
+ video_p75_watched_actions = 'video_p75_watched_actions'
2395
+ video_p95_watched_actions = 'video_p95_watched_actions'
2396
+ video_start_actions = 'video_start_actions'
2397
+
2398
+ @classmethod
2399
+ def get_endpoint (cls ):
2400
+ return 'insights'
2401
+
2402
+ class Preset (object ):
2403
+ last_14_days = 'last_14_days'
2404
+ last_28_days = 'last_28_days'
2405
+ last_30_days = 'last_30_days'
2406
+ last_3_months = 'last_3_months'
2407
+ last_week = 'last_week'
2408
+ last_90_days = 'last_90_days'
2409
+ last_month = 'last_month'
2410
+ last_week = 'this_week'
2411
+ this_month = 'this_month'
2412
+ this_quarter = 'this_quarter'
2413
+ today = 'today'
2414
+ yesterday = 'yesterday'
2415
+
2416
+ class Increment (object ):
2417
+ monthly = 'monthly'
2418
+ all_days = 'all_days'
2419
+
2420
+ class Breakdown (object ):
2421
+ age = 'age'
2422
+ country = 'country'
2423
+ gender = 'gender'
2424
+ impression_device = 'impression_device'
2425
+ placement = 'placement'
2426
+
2427
+ class Level (object ):
2428
+ account = 'account'
2429
+ adgroup = 'adgroup'
2430
+ campaign = 'campaign'
2431
+ campaign_group = 'campaign_group'
2432
+
2433
+ class ActionBreakdown (object ):
2434
+ action_destination = 'action_destination'
2435
+ action_device = 'action_device'
2436
+ action_target_id = 'action_target_id'
2437
+ action_type = 'action_type'
2438
+ action_video_type = 'action_video_type'
2439
+
2440
+ class ActionAttributionWindow (object ):
2441
+ click_1d = '1d_click'
2442
+ view_1d = '1d_view'
2443
+ click_28d = '28d_click'
2444
+ view_28d = '28d_view'
2445
+ click_7d = '7d_click'
2446
+ view_7d = '7d_view'
2447
+ default = 'default'
2448
+
2449
+ class Operator (object ):
2450
+ all = 'all'
2451
+ any = 'any'
2452
+ contain = 'contain'
2453
+ equal = 'equal'
2454
+ greater_than = 'greater_than'
2455
+ greater_than_or_equal = 'greater_than_or_equal'
2456
+ in_ = 'in'
2457
+ in_range = 'in_range'
2458
+ less_than = 'less_than'
2459
+ less_than_or_equal = 'less_than_or_equal'
2460
+ none = 'none'
2461
+ not_contain = 'not_contain'
2462
+ not_equal = 'not_equal'
2463
+ not_in = 'not_in'
2464
+ not_in_range = 'not_in_range'
2465
+
2466
+ class ActionReportTime (object ):
2467
+ conversion = 'conversion'
2468
+ impression = 'impression'
0 commit comments