Matomo ÄPI“Actions.getPageUrls”在休息 api 调用时仅返回 100 行

问题描述 投票:0回答:2

我正在尝试使用以下代码从 matomo api“Actions.getPageUrls”获取数据:

import requests
import pandas as pd

api_url="baseapi"

PARAMS = {'module': 'API', 
          'method':'Actions.getPageUrls', 
          'period' : 'range',
          'date': '2019-01-01,2020-01-01',
          'filter_limit' : '-1',
          'idSite': '1', 
          'format': 'JSON',
          'expanded' : '1',
          'token_auth': "tocken"}

r = requests.post(url = api_url, params = PARAMS, verify=False)
print(r.url)
matomo_df = pd.DataFrame(r.json())
matomo_df.head()
matomo_df['label']
matomo_df = pd.DataFrame(r.json()[0]['subtable'])
matomo_df

但是,它只返回 100 行。

我想要获得超过 100 行。你能帮我一下吗?

matomo
2个回答
0
投票

默认情况下,它设置为仅返回 100 行,但是当您将 'filter-limit' 设置为 -1 时,它应该返回所有行。您可以将 'filter-limit' 参数设置为 10000 并尝试一下吗.


0
投票

除了需要在 API 调用中覆盖过滤器限制之外,还有 Matomo 服务器配置设置可以控制归档期间记录的行数。

引用默认 Matomo v4.15.1 配置文件中的注释

; during archiving, Matomo will limit the number of results recorded, for performance reasons

; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
datatable_archiving_maximum_rows_actions = 500

; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
; note: should not exceed the display limit in Piwik\Actions\Controller::ACTIONS_REPORT_ROWS_DISPLAY
; because each subdirectory doesn't have paging at the bottom, so all data should be displayed if possible.
datatable_archiving_maximum_rows_subtable_actions = 100

使用默认配置,在顶层(

/blog
/help
/contact
等),您应该能够获得最多 500 个 URL,但对于每个子路径(
/blog/*
/help/*
/contact/*
),只有 100 个 URL,其余的被分组为“其他”。

© www.soinside.com 2019 - 2024. All rights reserved.