def main(account_id): Log("info", "getting keyword performance from the api", "", account_id) report = Report(account_id, "", options) df = report.createDfWithAllDateRanges(account_id) if functions.dfIsEmpty(df): return # print df[df.google_id=="309491001346"].cpc_bid # remember column headers are as per the download here df["keyword_id"] = df.apply(lambda row: functions.addIdToDf( account_id, row["Keyword ID"], row["Ad group ID"]), axis=1) df["id"] = df["keyword_id"] df = addParentId(df, account_id) # our UUID from the keywords table df = report.basicProcessing(df) df = reportSpecificProcessing(df) report.writeToEntitiesTable(df, report, account_id) report.writeToPerformanceTable(df, report, account_id)
def main(account_id): Log("info", "getting campaign performance from the api", "", account_id) report = Report(account_id, "", options) df = report.createDfWithAllDateRanges(account_id) if functions.dfIsEmpty(df): return # remember column headers are as per the download here df["campaign_id"] = df.apply( lambda row: functions.addIdToDf(account_id, row["Campaign ID"]), axis=1) df["id"] = df["campaign_id"] df = report.basicProcessing(df) report.writeToEntitiesTable(df, report, account_id) report.writeToPerformanceTable(df, report, account_id)
def main(account_id): Log("info", "getting search query performance from the api", "", account_id) report = Report(account_id, "", options) df = report.createDfWithAllDateRanges(account_id) if functions.dfIsEmpty(df): return df = df.groupby(['Search term', 'date_range'], as_index=False).sum() df["search_query_id"] = df.apply( lambda row: functions.addIdToDf(account_id, row["Search term"]), axis=1) df["id"] = df["search_query_id"] df = report.basicProcessing(df) report.writeToEntitiesTable(df, report, account_id) report.writeToPerformanceTable(df, report, account_id) return df