question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Analytics chart showing incorrect data/dates for Users

See original GitHub issue

Bug Description

On the Analytics chart, the user count displayed when viewing a single date is actually showing data for the following day.

Additionally, the previous month is showing the same date as the selected range but the data is correct.

The label displayed that represents the previous range doesn’t accurately reflect what is actually being seen. Instead of displaying Previous Month, perhaps the label should show the selected range such as Previous 90 Days. Alternatively, we could mirror what is being done in the Analytics UI and use the actual date ranges.

Discovered while investigating #1280.

Steps to reproduce

Off by one data:

  1. Go to the Analytics screen in Site Kit
  2. Hover over any date on the blue line to view User count for that day.
  3. Compare the same date in Analytics account.

Incorrect previous date:

  1. Go to the Analytics screen in Site Kit
  2. Hover over any date on the blue line to view User count for that day.
  3. Hover the same date on the dashed line
  4. The dates for both ranges are the same but the User count is correctly displayed.

Screenshots

Off by one data data-offset.png

Incorrect previous date: The previous date should read Apr 2, 2020 here. same-date.gif

Additional Context

  • PHP Version: 7.2
  • OS: Mac OS
  • Browser: Crome
  • Plugin Version: develop branch.
  • Device: MacBook Pro

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Analytics statistics should display the correct date-specific value for each date
  • The Audience overview chart should label the “Previous month” series as “Previous period” (widget/area titles already have the duration)
  • The series referenced when hovering an individual node in the “Previous month” series, should be labeled as “Previous period”.

Implementation Brief

  • In assets/js/modules/analytics/util/index.js make the following changes:
    • Extract the year, month and day from dateString
    • Adjust the month to be zero-indexed.
    • Pass the values new Date( year, month, day) to get the correct date.
  • Merge #1395

QA Brief

  • Go to the Analytics screen in Site Kit
  • Hover over any date on the blue line to view User count for that day.
  • Compare the same date in the Analytics account to confirm that the day is displaying the correct User count for that day.

Changelog entry

  • Fix Analytics data displayed for Users being partially incorrect due to incorrect date parsing.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aaemnnosttvcommented, Apr 27, 2020

@ryanwelcher would you please add an IB for this since you’re the most familiar with the code here?

1reaction
marrrmarrrcommented, Apr 27, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Your Google Analytics Data is Inaccurate and How To Fix It
Here we break down 4 common scenarios where Google Analytics is giving you inaccurate numbers and how to make the quick fixes.
Read more >
Date Axis in Excel Chart is wrong - AuditExcel
Date Axis in Excel Chart is wrong? Showing gaps where it should show each listed date? Understand why, and how to fix the...
Read more >
6 Common Google Data Studio Problems and How to Fix Them
Problem 2: Date fields not showing correctly in Data Studio ... data sources, and users often want to filter graphs based on other...
Read more >
Chart showing incorrect value - Microsoft Power BI Community
Solved: I have two stacked column chart : chart one displays net sales sum by year (x axis) and other chart shows net...
Read more >
Incorrect Count in User Analysis Management Report
Hello Experts, Can anyone please explain the logic behind the count displayed on users analysis management report.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found