How to include more than one metric in a Ranked Report

Posted: November 25, 2008, 2:45am
How to include more than one metric in a Ranked Report

Hi, I've been trying without success to build a request to pull a site section report with page views, visits and monthly unique visitors. When including just one metric the report runs without issue, when I add another metric it fails with "Invalid Metric". Below is the soap request, has anyone managed to generate successful request with more than one metric.

<reportDescription xsi:type="ns1:reportDescription">

  <reportSuiteID xsi:type="xsd:string"></reportSuiteID>

    <date xsi:type="xsd:string">2008-10</date>

    <dateFrom xsi:nil="true"/>

    <dateTo xsi:nil="true"/>

    <dateGranularity xsi:nil="true"/>

    <metrics SOAP-ENC:arrayType="ns1:reportDefinitionMetric[2]" xsi:type="ns1:reportDefinitionMetricList">

       <item xsi:type="ns1:reportDefinitionMetric">

         <id xsi:type="xsd:string">pageviews</id>

         <segment xsi:nil="true"/>

       </item>

       <item xsi:type="ns1:reportDefinitionMetric">

         <id xsi:type="xsd:string">visits</id><segment xsi:nil="true"/>

       </item></metrics>

       <sortBy xsi:nil="true"/>

  <elements SOAP-ENC:arrayType="ns1:reportDefinitionElement[1]" xsi:type="ns1:reportDefinitionElementList">

    <item xsi:type="ns1:reportDefinitionElement">

      <id xsi:type="xsd:string">siteSection</id>

      <classification xsi:nil="true"/>

      <top xsi:type="xsd:int">10</top>

      <startingWith xsi:nil="true"/>

      <search xsi:nil="true"/>

      <selected xsi:nil="true"/>

      <expanded xsi:nil="true" xsi:type="ns1:reportDefinitionExpanded"/>

    </item>

</elements>

<locale xsi:nil="true" xsi:type="ns1:reportDefinitionLocale"/>

</reportDescription>

Martin

I've seen similar issues when using PHP's SOAP client

I've run into this same problem when using the SOAP library that comes with PHP. I've found that using nuSoap corrects the problem.

It had something to do with PHP's SOAP reading the WSDL wrong. I tried making modifications to the WSDL without success.

I'm not sure if you're using PHP or not, but I figured I'd offer this in case the problem is related.

I didn't see your original

I didn't see your original SOAP request in the comment, but something like this should work:

 

         <reportDescription xsi:type="omn:reportDescription">
            <reportSuiteID xsi:type="xsd:string">report.suite</reportSuiteID>
            <date xsi:type="xsd:string">2008-11</date>
            <metrics soapenc:arrayType="tns:reportDefinitionMetric[3]" xsi:type="soapenc:Array">
               <item xsi:type="tns:reportDefinitionMetric">
                  <id xsi:type="xsd:string">pageViews</id>
               </item>
               <item xsi:type="tns:reportDefinitionMetric">
                  <id xsi:type="xsd:string">visits</id>
               </item>
               <item xsi:type="tns:reportDefinitionMetric">
                  <id xsi:type="xsd:string">visitorsdaily</id>
               </item>
            </metrics>
            <elements soapenc:arrayType="omn:reportDefinitionElement[1]" xsi:type="soapenc:Array">
               <item xsi:type="tns:reportElement">
                  <id>page</id>
                  <top>5</top>
                  <startingWith>5</startingWith>
               </item>
            </elements>
            <locale xsi:type="omn:reportDefinitionLocale">en_US</locale>
         </reportDescription>

J

Hi, I've tried this request

Hi,

I've tried this request to match yours, but I still get the same issue. Removing the extra metrics allows the request to work without the "Invalid Metric" error. I've run the request with each of the metrics to confirm that all the metrics are valid.

<reportDescription xsi:type="ns1:reportDescription">
<reportSuiteID xsi:type="xsd:string">aolukjunglobal
</reportSuiteID>
<date xsi:type="xsd:string">2008-11
</date>
<dateFrom xsi:nil="true"/>
<dateTo xsi:nil="true"/>
<dateGranularity xsi:nil="true"/>
<metrics SOAP-ENC:arrayType="ns1:reportDefinitionMetric[3]" xsi:type="ns1:reportDefinitionMetricList">
<item xsi:type="ns1:reportDefinitionMetric">
<id xsi:type="xsd:string">pageviews
</id>
<segment xsi:nil="true"/>
</item>
<item xsi:type="ns1:reportDefinitionMetric">
<id xsi:type="xsd:string">visits
</id>
<segment xsi:nil="true"/>
</item>
<item xsi:type="ns1:reportDefinitionMetric">
<id xsi:type="xsd:string">visitorsdaily
</id>
<segment xsi:nil="true"/>
</item>
</metrics>
<sortBy xsi:nil="true"/>
<elements SOAP-ENC:arrayType="ns1:reportDefinitionElement[1]" xsi:type="ns1:reportDefinitionElementList">
<item xsi:type="ns1:reportDefinitionElement">
<id xsi:type="xsd:string">page
</id>
<classification xsi:nil="true"/>
<top xsi:type="xsd:int">5
</top>
<startingWith xsi:type="xsd:int">5
</startingWith>
<search xsi:nil="true"/>
<selected xsi:nil="true"/>
<expanded xsi:nil="true" xsi:type="ns1:reportDefinitionExpanded"/>
</item>
</elements>
<locale xsi:type="ns1:reportDefinitionLocale">en_US
</locale>
</reportDescription>