Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce link statistics csv download #1233

Merged
merged 7 commits into from
Feb 24, 2021
Merged

Introduce link statistics csv download #1233

merged 7 commits into from
Feb 24, 2021

Conversation

yong-jie
Copy link
Member

@yong-jie yong-jie commented Feb 23, 2021

Problem

Users have been reaching out to us to retrieve their past link statistics. This feature allows them to download the full link statistics in a CSV format.

Closes #1155

Solution

There is an existing API route used by link stats graph to fetch the last 7 days of clicks. I modified it to allow the number of days to be customisable via URL query params. This approach maximises code reuse and opens future opportunities to allow more days of data to be displayed in link stats graphs.

Also added a button in frontend to call the API and generate CSV.

Before & After Screenshots

AFTER:
image

@yong-jie yong-jie requested a review from LoneRifle February 23, 2021 17:16
Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

import { useDrawerState } from '../../../../index'

async function downloadClicks(shortUrl: string, onError: () => void) {
const offsetDays = 3650
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ten years of statistics? is that going to be okay?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed that the server presently has no issues with the amount of data to fetch and should not be an issue for awhile, at least until we allow more control over the period of data to download.

@yong-jie yong-jie merged commit ac31f11 into develop Feb 24, 2021
@yong-jie yong-jie deleted the link-stats-csv branch February 24, 2021 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce link statistics csv download
2 participants