jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

WPCOM API / stats: stats/visits endpoint doesn't return views and visitors if last day of the month is passed as a parameter

Open staskus opened this issue 1 year ago • 1 comments

Impacted plugin

Jetpack

Quick summary

Today is March 1. Passing date=2024-03-31 to stats/visits?unit=month&quantity=1 returns 0 views and visitors, while passing date=2024-03-30 returns a correct number.

WP.COM API GET v1.1/sites/180619633/stats/visits?unit=month&quantity=1&date=2024-03-31

Response (wrong)
{
	"date": "2024-03-31",
	"unit": "month",
	"fields": [
		"period",
		"views",
		"visitors",
		"likes",
		"reblogs",
		"comments",
		"posts"
	],
	"data": [
		[
			"2024-03-01",
			0,
			0,
			4,
			0,
			5,
			2
		]
	]
}

WP.COM API GET v1.1/sites/180619633/stats/visits?unit=month&quantity=1&date=2024-03-30

Response
{
	"date": "2024-03-30",
	"unit": "month",
	"fields": [
		"period",
		"views",
		"visitors",
		"likes",
		"reblogs",
		"comments",
		"posts"
	],
	"data": [
		[
			"2024-03-01",
			79,
			17,
			4,
			0,
			6,
			2
		]
	]
}

Steps to reproduce

  1. https://developer.wordpress.com/docs/api/console/
  2. WP.COM API GET v1.1/sites/$site/stats/180619633?unit=month&quantity=1&date=2024-03-31
  3. "data": views, and visitors are 0. Other fields: visitors, likes, reblogs, and comments have correct values.

A clear and concise description of what you expected to happen.

No response

What actually happened

No response

Impact

Most (> 50%)

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

No response

Logs or notes

No response

staskus avatar Mar 01 '24 12:03 staskus

Related discussion: p1709296218622579-slack-C82FZ5T4G

jeherve avatar Mar 04 '24 09:03 jeherve