Php 使用Piwik API获取自定义变量值

Php 使用Piwik API获取自定义变量值,php,matomo,Php,Matomo,我正在尝试使用此api CustomVariables.getCustomVariablesValuesFromNameId(idSite、period、date、idSubtable、segment='')从piwik获取CustomVariable值。但是没有关于它的例子,也没有关于如何获取idsubtable值的例子 有没有办法使用api从piwik获取自定义变量值 任何帮助或示例都将不胜感激。当然-乍一看这并不容易。下面是它的工作原理: 您可以在中找到CustomVariables.ge

我正在尝试使用此api CustomVariables.getCustomVariablesValuesFromNameId(idSite、period、date、idSubtable、segment='')从piwik获取CustomVariable值。但是没有关于它的例子,也没有关于如何获取idsubtable值的例子

有没有办法使用api从piwik获取自定义变量值


任何帮助或示例都将不胜感激。

当然-乍一看这并不容易。下面是它的工作原理:

您可以在中找到
CustomVariables.getCustomVariables
的示例。生成的XML包含所有现有的自定义变量

让我们以以下内容为例:

<result>
    <row>
        <label>Forum status</label>
        <nb_visits>593</nb_visits>
        <nb_actions>1571</nb_actions>
        <max_actions>40</max_actions>
        <sum_visit_length>116860</sum_visit_length>
        <bounce_count>389</bounce_count>
        <goals>
            <row idgoal='1'>
                <nb_conversions>5</nb_conversions>
                <nb_visits_converted>5</nb_visits_converted>
                <revenue>15</revenue>
            </row>
            <row idgoal='2'>
                <nb_conversions>9</nb_conversions>
                <nb_visits_converted>9</nb_visits_converted>
                <revenue>9</revenue>
            </row>
            <row idgoal='3'>
                <nb_conversions>2</nb_conversions>
                <nb_visits_converted>2</nb_visits_converted>
                <revenue>2</revenue>
            </row>
        </goals>
        <nb_conversions>16</nb_conversions>
        <revenue>26</revenue>
        <idsubdatatable>110</idsubdatatable>
    </row>
</result>
每行的
包含一个
论坛状态
自定义变量的值以及该值的度量

<result>
    <row>
        <label>Anonymous</label>
        <nb_visits>544</nb_visits>
        <nb_actions>1185</nb_actions>
        <max_actions>38</max_actions>
        <sum_visit_length>83459</sum_visit_length>
        <bounce_count>380</bounce_count>
        <goals>
            <row idgoal='1'>
                <nb_conversions>5</nb_conversions>
                <nb_visits_converted>5</nb_visits_converted>
                <revenue>15</revenue>
            </row>
            <row idgoal='2'>
                <nb_conversions>9</nb_conversions>
                <nb_visits_converted>9</nb_visits_converted>
                <revenue>9</revenue>
            </row>
        </goals>
        <nb_conversions>14</nb_conversions>
        <revenue>24</revenue>
    </row>
    <row>
        <label>LoggedIn user</label>
        <nb_visits>49</nb_visits>
        <nb_actions>386</nb_actions>
        <max_actions>40</max_actions>
        <sum_visit_length>33401</sum_visit_length>
        <bounce_count>9</bounce_count>
        <goals>
            <row idgoal='3'>
                <nb_conversions>2</nb_conversions>
                <nb_visits_converted>2</nb_visits_converted>
                <revenue>2</revenue>
            </row>
        </goals>
        <nb_conversions>2</nb_conversions>
        <revenue>2</revenue>
    </row>
</result>