{"id":13522750,"url":"https://github.com/stefanofranco/yourls-api-shorturl-analytics","last_synced_at":"2025-03-31T23:32:20.527Z","repository":{"id":230008363,"uuid":"778204838","full_name":"stefanofranco/yourls-api-shorturl-analytics","owner":"stefanofranco","description":"This plugin adds a custom API action 'shorturl_analytics' to show stats in a range of dates.","archived":false,"fork":false,"pushed_at":"2024-06-25T09:16:50.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-02T07:33:08.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanofranco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-27T09:29:04.000Z","updated_at":"2024-06-25T09:16:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d0690a1-d78e-4168-a0a4-d032b6539f33","html_url":"https://github.com/stefanofranco/yourls-api-shorturl-analytics","commit_stats":null,"previous_names":["stefanofranco/yourls-api-shorturl-analytics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanofranco%2Fyourls-api-shorturl-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanofranco%2Fyourls-api-shorturl-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanofranco%2Fyourls-api-shorturl-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanofranco%2Fyourls-api-shorturl-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanofranco","download_url":"https://codeload.github.com/stefanofranco/yourls-api-shorturl-analytics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246558108,"owners_count":20796696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:00:51.870Z","updated_at":"2025-03-31T23:32:15.510Z","avatar_url":"https://github.com/stefanofranco.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["A"],"readme":"# Plugin for YOURLS: API ShortURL Analytics\n\n[![Plugin Name](https://img.shields.io/badge/Plugin%20Name-ShortURL%20Analytics-blue)](https://github.com/stefanofranco/yourls-api-shorturl-analytics)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Description\n\nYourls API ShortURL Analytics is a plugin for Yourls that provides analytics for short URLs via a custom API action. This plugin allows users to retrieve detailed statistics for short URLs within a specified date range.\n\n## Requirements\n\nThis plugin requires YOURLS version 1.7.3 and above and Php \u003e= 7.0.\n\n**Note**: Please, if you've tested it with other versions and it works fine, contact me and I will update this section.\n\n\n## Installation\nDownload the latest release from the releases page.\nExtract the contents to a folder named `yourls-api-shorturl-analytics` within the `/user/plugins` directory of your Yourls installation.\nActivate the plugin from the Plugins administration page (http://yourls-site.com/admin/plugins.php).\nYou're ready to go!\nLicense\nThis package is licensed under the MIT License.\n\n## Usage\n\nThis plugin extends Yourls API functionality to include a custom action for retrieving analytics data for short URLs. The action can be accessed through the endpoint `/yourls-api.php`, and requires the following parameters:\n\n- `date`: The start date for the analytics data (required).\n- `date_end`: The end date for the analytics data (optional, defaults to the start date if not provided).\n- `shorturl`: The short URL for which analytics data is requested (required).\n\n### Example - Stats for a specific date\n\n```bash\ncurl -X GET \"http://yourls-site.com/yourls-api.php?signature=YourSignature\u0026action=shorturl_analytics\u0026date=2024-01-01\u0026shorturl=abc123\"\n```\n```bash\n# Sample result for a specific date\n# Parameters: date = 2024-01-01\n{\n  \"statusCode\": 200,\n  \"message\": \"success\",\n  \"stats\": {\n    \"total_clicks\": 15, # Total clicks (lifetime)\n    \"range_clicks\": 15, # Total clicks (in the range)\n    \"daily_clicks\": {\n      \"2024-01-01\": 15 # Total clicks (in the specific date)\n    }\n  }\n}\n```\n\n### Example - Stats for a date range\n\n```bash\ncurl -X GET \"http://yourls-site.com/yourls-api.php?signature=YourSignature\u0026action=shorturl_analytics\u0026date=2024-01-01\u0026date_end=2024-12-31\u0026shorturl=abc123\"\n```\n\n```bash\n# Sample result for a date range\n# Parameters: date = 2024-01-01, date_end = 2024-01-05\n{\n    \"statusCode\": 200,\n    \"message\": \"success\",\n    \"stats\": {\n        \"total_clicks\": 120, # Total clicks (lifetime)\n        \"range_clicks\": 24, # Total clicks (in the range)\n        \"daily_clicks\": {\n          \"2024-01-01\": 15 # Total clicks (in the specific date)\n          \"2024-01-02\": 8,\n          \"2024-01-03\": 1,\n          \"2024-01-04\": 0,\n          \"2024-01-05\": 0\n        }\n    }\n}\n```\n\n## Author\nCreated by [Stefano Franco](https://github.com/stefanofranco/yourls-api-shorturl-analytics).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanofranco%2Fyourls-api-shorturl-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanofranco%2Fyourls-api-shorturl-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanofranco%2Fyourls-api-shorturl-analytics/lists"}