查询站点今天的网站概况(趋势数据)报表:
import baidutongji
baidutongji.getTimeTrendRpt('{ACCESS_TOKEN}', '{SITE_ID}', datetime.date.today(), datetime.date.today(), TimeTrendRptMetrics(pv_count=True, visitor_count=True, ip_count=True, bounce_ratio=True, avg_visit_time=True))
或者可以简化:
import baidutongji
baidutongji.getTimeTrendRpt('{ACCESS_TOKEN}', '{SITE_ID}', datetime.date.today(), datetime.date.today(), TimeTrendRptMetrics().setAllTrue())
查询 2022/01/01 ~ 2022/01/10
与 2022/04/01 ~ 2022/04/10
趋势分析对比报表,指定时间粒度以天为单位,筛选用户为老用户,访问设备为 PC,地区为上海市:
import baidutongji
baidutongji.getTrendTime('{ACCESS_TOKEN}', '{SITE_ID}', datetime.date(2022, 1, 1), datetime.date(2022, 1, 10), TrendTimeMetrics().setAllTrue(), datetime.date(2022, 4, 1), datetime.date(2022, 4, 10), Source.ALL, ClientDevice.PC, VisitorType.RETURN, TimeGran.DAY, Region(RegionType.PROVINCE, '上海'))