Monthly Unique Visitors empty in API response

ellenm34798618

18-09-2019

Hello,

I'm trying to extract daily and monthly unique visitors using the Analytics API, but the metrics are always returning 0 instead of the value seen in the Reports UI. The metric identifiers I'm using are metrics/visitorsmonthly and metrics/visitorsdaily.

An example JSON request:

{

    "rsid": "***",

    "globalFilters": [

        {

            "type": "dateRange",

            "dateRange": "2019-09-16T00:00:00/2019-09-17T00:00:00"

        }

    ],

    "metricContainer": {

        "metrics": [

            {

                "columnId": "pageviews",

                "id": "metrics/pageviews"

            },

            {

                "columnId": "videostart",

                "id": "metrics/videostart"

            },

            {

                "columnId": "timespentvisit",

                "id": "metrics/timespentvisit"

            },

            {

                "columnId": "visitorsmonthly",

                "id": "metrics/visitorsmonthly"

            },

            {

                "columnId": "visitorsdaily",

                "id": "metrics/visitorsdaily"

            }

        ]

    },

    "dimension": "variables/daterangeday",

    "settings": {

        "countRepeatInstances": true,

        "limit": 50,

        "page": 0,

        "dimensionSort": "asc"

    },

    "statistics": {

        "functions": [

            "col-max",

            "col-min"

        ]

    }

}

And the response:

{

  "totalPages": 1,

  "firstPage": true,

  "lastPage": true,

  "numberOfElements": 1,

  "number": 0,

  "totalElements": 1,

  "columns": {

    "dimension": {

      "id": "variables/daterangeday",

      "type": "time"

    },

    "columnIds": [

      "pageviews",

      "videostart",

      "timespentvisit",

      "visitorsmonthly",

      "visitorsdaily"

    ]

  },

  "rows": [

    {

      "itemId": "1190816",

      "value": "Sep 16, 2019",

      "data": [

        652710,

        685738,

        611.7979478807963,

        0,

        0

      ]

    }

  ],

  "summaryData": {

    "nonesFilteredTotals": [

      652710,

      685738,

      611.7979478807963,

      0,

      0

    ],

    "totals": [

      652710,

      685738,

      611.7979478807963,

      0,

      0

    ],

    "col-max": [

      652710,

      685738,

      611.7979478807963,

      0,

      0

    ],

    "col-min": [

      652710,

      685738,

      611.7979478807963,

      0,

      0

    ]

  }

}

Has anyone successfully used these metrics in the Analytics API? Am I missing a requirement for using them?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

ursboller

MVP

19-09-2019

API 2.0 and Analytics Workspace have the same "reporting engine". means if it is not available in workspace, I wouldn't expect it to be on any API 2.0 call....

Answers (2)

Answers (2)

ellenm34798618

19-09-2019

Daily/Monthly unique visits are not available in Workspace according to this thread: Why Daily, Weekly & Monthly Unique Visitor Metrics not showing up in the Workspace? The metrics are listed in the /metrics API response, so I figured they'd be supported in the API.

I'm not completely sure, but I don't think the RS is a VRS. I didn't set it up, and I can't find a way to identify if it is or not.